Jump to content

Wingthor

Members
  • Posts

    44
  • Joined

  • Last visited

Posts posted by Wingthor

  1. For now, gives you current month.

    Assuming you are using the Touchdown stats from David Clark...

    Add the following to the file TouchdownStatsData.class.php located under common (BACKUP FIRST!!!!) MARK! Both inpastes must go over the last '}' brackets in the bottom of files.

    //Added by [your name] 2011.xx.xx
    get_stats_by_cur_month ()
    
    
    
    $query =  "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps`
    WHERE landingrate < '0' and MONTH(submitdate)=MONTH(curdate())
    ORDER BY landingrate DESC";
    
    return DB::get_results($query);}

    Then add to the following file under module, TouchdownStats TouchdownStats.php

    //Added by [your name] 2011.xx.xx
    public function top_landing_this_month ()
    { 
    
    $this->set('stats', TouchdownStatsData::get_stats_by_cur_month());
    $this->show('touchdownstats/touchdownstats_index.tpl');
    }

    Link to http://your.site.ok/TouchdownStats/top_landing_this_month

    The month selection require a bit more work. If you want limit the returned data, use same technique as above and paste in addition in TouchdownStatsData.class.php:

    //Added by [your name] 2011.xx.xx
    public function get_stats_by_cur_month_limited ($howmany)
    	{
    
    
    	$query =  "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps`
                       WHERE landingrate < '0' and MONTH(submitdate)=MONTH(curdate())
                       ORDER BY landingrate DESC";
    
    	return DB::get_results($query);
    	}

    And in th file TouchdownStats.php:

    public function top_landing_this_month_limited ()
    { 
    
    	$this->set('stats', TouchdownStatsData::get_stats_by_cur_month_limited($howmany));
    	$this->show('touchdownstats/touchdownstats_index.tpl');
    }
    

    To link limits use /top_landing_this_month_limited/X where x is the number you want to limit it to.

    Must say my database is rather slim, so I don't know how this will look in a big DB. Anyway copy the files you are manipulating, ALWAYS.

    Sorry for the brief answer, will come up with the month selection later. Make a mark that the scritp will return an error if the dataset is empty in the foreach clause in the tpl file. So probably you will get an error in the begining of each month :).

    Regards

    • Like 1
  2. Hi again...

    I currently working with an addon which I think will have to 'explode' the raw data from the pireps table in the database. When inspecting the database it seems like FSPassengers pirep's raw data goes to the field log, while fsfk's goes to the table source. Where the free Xacars goes I don't know, does any one know?

    Is this a bug, which I can expected to be fixed? It is no big issue, but it is nice to know when coding the addon.

    Regards

    Never mind, seems like the reports in the fspx pireps missing aircraft info. Guess thats why some data apears in the log field of the table.

  3. Yeah, Im considiring building a kind of SQL generator. But Im not sure if it that can be done, since I am planning to extract info from the RAW PIREPS data. There is a lot more info in these than it is is fields in the pireps table, so builing a flexible easy to use SQL generator might be difficult.

    Regards

  4. That would be a good edition as this is all manually done at the moment apart from the ranks which are tied in to specified hours in the admin section.

    You would have to create a module for the admin side with the logic and definable parameters.

    Would be nice to see :)

    It will be an adminstration addon, where you can activate predefined awards. Thats why I need as many predefined awards as possible. In case you want give awards for number of landings, you just define how many landings the pilot needs before he is awarded, then activate the award. Then it will activate event driven scripts which parses the awards into phpvms's ordinary award system. Think that should work.

    Regards

  5. Hi all,

    I currently have som spare time, and wants to refresh my PHP knowledge. I also want to have a nice frontpage showing new awards. So I need a lot of them. The deadline for the project is currently open.

    First question is that if this is build before?

    Second is I could need som input creating awards. I have pasted in the result of my brainstoring below, but need som input from the public. The system is a kind of inspired by FSX own award system. Hopefully it can contribute to an internal and friendly competition among your pilots. The awards must be based on objective data from an acars system. So the data must be there, and the data must be able to be extraced with sql, eg x number of landings. Every contribution is appreciated, I will judge if I can get out the data. You can also comment on what I have come up with so far. Espesially I need help on the naming of the awards. You will understand when reading the output on my braingstorming.

    Typeof awards:

    Landings

    x number of landings [several intervals]

    x landing on a particullary [difficult] airfield [several intervals]

    x landing rate below ...

    best landing of a month/year

    worst landing of the month and landing rate greater than xx (drunken pilot)

    x number of landings with rate lower than y in a row

    Time

    x hours flown

    schedueld flights ontime block to block with respect to bid....

    deviance less than x time

    Spent to much time on the toilet with xx/xy (member 10000m club) worst scheduele miss for a given time (month).

    x hours flown

    x hrs online flying

    Aircraft type

    Most hours flown month/year

    longest distance month/year

    Most landings month/year

    lowest fbh a month/year

    max speed and landed a month

    Distance

    Most nm a month/year

    x nm distance flown, several numbers....like promoting

    most dist/hours a month/year

    Passenger flown

    x numbers

    Cargo flown

    x numbers [several intervals]

    Thanks in advance...

  6. Hi again...

    I currently working with an addon which I think will have to 'explode' the raw data from the pireps table in the database. When inspecting the database it seems like FSPassengers pirep's raw data goes to the field log, while fsfk's goes to the table source. Where the free Xacars goes I don't know, does any one know?

    Is this a bug, which I can expected to be fixed? It is no big issue, but it is nice to know when coding the addon.

    Regards

  7. You can create your own admin module just as you can on the pilot side. Just place it in the admin/modules folder. To automatically add your link under the addons section of the admin menu put this in your new module file

    Stupid question...

    Where is the addons section of the admin menu B) ?

    Regards

  8. You're going to want to leave $page_content in your layout.tpl, otherwise pages won't have their content.

    To add custom pages, you can either create them through the Pages thing in the admin panel or create your own module to show the template, which would look something like this:

    <?php
    
    class MyPage extends CodonModule 
    {
    
    	public function index()
    	{
    	Template::Show('mypage.tpl');
    
    	}
    
    }
    
    ?>

    Which would be in MyPage.php in a core/modules/MyPage/ folder, and to view it would be mysite.com/index.php/MyPage

    Alternatively, if you're just wanting to edit the homepage, change the code in frontpage_main.tpl

    Ok, I see. So in the documentation where it states:

    "As you can see, this is the entire HTML page, with several important variables being output:

    * <?php echo $page_title ?> - This goes between the title tags

    * <?php echo $page_htmlhead;?> - This goes right above the </head> tag

    * <?php echo $page_htmlreq; ?> - This goes immediately following the <body> tag

    * <?php echo $page_content;?> - This goes where the body of the page (the content) is supposed to show

    You can use the Template::Show() calls instead of the above ones, it's the same thing. For an example, view the crystal (the default skin) layout.tpl file. If there is a layout.tpl file, then the header.tpl and footer.tpl files will get ignored."

    That goes for you can choose to use "<?php echo $page_content;?>" or Template::Show('page_content')

    Ok, thats fine I will find a way. Thanks for a quick reply :D

    Regards

  9. I am developing a new VMS site. I don't want the "echo $page_content;" in my layout.tpl file. But want to pont to an other tpl file. As it is stated in the 'Editing Template' page in the PHPVMS homepage documentation (http://forum.phpvms.net/page/index.html?record=32), it states that I can put a template dir under my lib/skins/[template), and call it by the fuction Template::Show('whichever.tpl').

    I have made a 'test.tpl' file under my skins templates directory directory, and added (Template::Show('test.tpl'); to the layout.tpl file in skin root directory. This generated this error:

    "Notice: The template file "/phpvms//core/templates/test.tpl" doesn't exist in /phpvms/core/classes/TemplateSet.class.php on line 248"

    So why does phpvms don't find the test.tpl under my skins directory. I have also noticed the the double '//' between phpvms and core in the error message. The file isn't there anyway. And I want it to look under '/var/www/phpvms/lib/skins'. So is my method wrong? I don't want the template to written over by any update.

    Regards

    Wingthor

  10. Well, CLI is different. You have to make sure it's configured correctly to host on localhost or wherever your server is supposed to be setup. But in short, MySQL isn't setup correctly

    The problem is that the database is gone corrupt. From the mysql.log I get the following error on a bunch of files, when clicking on to my site, one for every table gone corrupt:

    Cannot find table phpvms/phpvms_pilots from the internal data dictionary

    of InnoDB though the .frm file for the table exists. Maybe you

    have deleted and recreated InnoDB data files but have forgotten

    to delete the corresponding .frm files of InnoDB tables, or you

    have moved .frm files to another database?

    See

    how you can resolve the problem.

    So I better dig after the the database from the orginal site and hope they are OK there.

    Think I can manage from here. Thanks for the help!!

    Regards

  11. There's on SITE_ROOT, that's figured out automatically.

    The error you posted above - seems as though it can't connect to the database. Make sure those settings are correct

    I can connect to the database from CLI using the data given in local.config.php. However, when cheking the database in webmin, it gives me the following error:

    SQL show index from `phpvms_acarsdata` failed : Table 'phpvms.phpvms_acarsdata' doesn't exist

    But I can't see the relevanse. Like I told earlier I can connect to the database fine from CLI (Command Line Interface) on my Linux server.

    Regards

  12. After I moved my phpvms site to an other server I get this error message:

    Notice: The template file "/var/www/phpvms//lib/skins/CURRENT_SKIN/header.tpl" doesn't exist in /var/www/phpvms/core/classes/TemplateSet.class.php on line 227

    Recent Reports

    No reports have been filed

    Newest Pilots

    Warning: Invalid argument supplied for foreach() in /var/www/phpvms/core/templates/frontpage_recentpilots.tpl on line 3

    Users Online

    There have been 0 user(s), and 1 guest(s) online in the past 20 minutes.

    Notice: The template file "/var/www/phpvms//lib/skins/CURRENT_SKIN/footer.tpl" doesn't exist in /var/www/phpvms/core/classes/TemplateSet.class.php on line 227

    What can that be?

    Skin is default, crystal and the only one installed.

    Regards

    Wingthor

×
×
  • Create New...