Jump to content

web541

Members
  • Posts

    700
  • Joined

  • Last visited

  • Days Won

    17

Posts posted by web541

  1. There aren't any available on phpvms. Someone tried to make one a while back, but it got taken down due to copyright infringement.

    I have made one before and it works like a charm! If you are willing to try it yourself, the following will get you started.

    http://forum.phpvms.net/topic/21990-editing-the-admin-skin-solved/#entry117689

    http://forum.phpvms.net/topic/23046-extracting-the-dashboard-pirep-data/

    http://forum.phpvms.net/topic/23055-vacentral-pireps-to-export-wont-display-when-inside-another-div/

    And here's what can be accomplished

    http://forum.phpvms.net/topic/18877-admin-centre-skin/

    It is a lot like skinning the main site.

  2. try flown_routes_map.php . I had the same problem, it seemed obvious that it would be route_map, but no.

    *If you are looking to change the style of the map instead of the default,

    Go to https://snazzymaps.com/ and find a map you like, then

    Replace

    var map = new google.maps.Map(document.getElementById("routemap"), options);
    

    With this

    var styles = PASTESTYLEHERE
    
    // Create a new StyledMapType object, passing it the array of styles,
    // as well as the name to be displayed on the map type control.
    var styledMap = new google.maps.StyledMapType(styles,
    {name: "Flight Map"});
    // Create a map object, and include the MapTypeId to add
    // to the map type control.
    var mapOptions = {
    zoom: 11,
    center: new google.maps.LatLng(55.6468, 37.581),
    mapTypeControlOptions: {
     mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'map_style']
    }
    };
    var map = new google.maps.Map(document.getElementById('routemap'),
    mapOptions);
    
    //Associate the styled map with the MapTypeId and set it to display.
    map.mapTypes.set('map_style', styledMap);
    map.setMapTypeId('map_style');
    

    and replace PASTESTYLEHERE with your Javascript Style Array from snazzymaps

  3. I've never done it using Charts.js, but I've used Morris Charts before.

    - You could probably tweak it for charts.js

    What I did was put the following in

    core/modules/Pilots/Pilots.php

    public function morrisstatsbymonthdata()
     {
    
    		 $data = PIREPData::getIntervalDataByMonth(array('p.pilotid'=>Auth::$userinfo->pilotid), 3);
    		 header("Content-type: application/json");
    		 echo json_encode($data);
    
     }
    
    public function morrisstatsaircraftdata($pilotid)
     {
    
    		 $data = StatsData::PilotAircraftFlownCountsMorris($pilotid);
    		 header("Content-type: application/json");
    		 echo json_encode($data);
    
     }
    

    core/common/StatsData.class.php

    public static function PilotAircraftFlownCountsMorris($pilotid)
    {
    $key = 'ac_flown_counts_1_'.$pilotid;
    
    $counts = CodonCache::delete($key);
    
    if($counts === true)
    {
    //Select aircraft types
    $sql = 'SELECT a.name AS label, COUNT(p.aircraft) AS value, SUM(p.flighttime) AS hours
     FROM '.TABLE_PREFIX.'pireps p, '.TABLE_PREFIX.'aircraft a
     WHERE p.aircraft = a.id AND p.pilotid='.intval($pilotid).'
     GROUP BY a.name';
    
    $counts = DB::get_results($sql);
    CodonCache::write($key, $counts, 'medium');
    }
    
    return $counts;
    }
    

    If your using phpvms 5.5.x

    core/common/StatsData.class.php

    public static function PilotAircraftFlownCountsMorris($pilotid)
    {
    $key = 'ac_flown_counts_1_'.$pilotid;
    
    $counts = CodonCache::delete($key);
    
    if($counts === false)
    {
    //Select aircraft types
    $sql = 'SELECT a.name AS label, COUNT(p.aircraft) AS value, SUM(p.flighttime) AS hours
       FROM '.TABLE_PREFIX.'pireps p, '.TABLE_PREFIX.'aircraft a
       WHERE p.aircraft = a.id AND p.pilotid='.intval($pilotid).'
       GROUP BY a.name';
    
    $counts = DB::get_results($sql);
    CodonCache::write($key, $counts, 'medium');
    }
    
    return $counts;
    }
    

    And here's my core/templates/profile_stats.tpl/php (should really be in lib/skins/XXX/profile_stats.tpl/php)

    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css">
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script>
    <h3>Your Stats</h3>
    <?php
    /*
    Added in 2.0!
    */
    $chart_width = '800';
    $chart_height = '250';
    /* Don Not need to change anything below this here */
    ?>
    <div align="center" style="width: 100%;">
    <div id="monthdata" style="height: 250px;"></div>
    </div>
    <br />
    <div align="center" style="width: 100%;">
    <div id="aircraftdata" style="height: 250px;"></div>
    </div>
    <script type="text/javascript">
    var json = (function () {
    		 var json = null;
    		 $.ajax({
    				 'async': false,
    				 'global': false,
    				 'url': "<?php echo actionurl('/pilots/morrisstatsbymonthdata');?>",
    				 'dataType': "json",
    				 'success': function (data) {
    						 json = data;
    				 }
    		 });
    		 return json;
     })
     ();
    
    new Morris.Line({
    // ID of the element in which to draw the chart.
    element: 'monthdata',
    // Chart data records -- each entry in this array corresponds to a point on
    // the chart.
    data: json,
    // The name of the data record attribute that contains x-values.
    xkey: 'ym',
    // A list of names of data record attributes that contain y-values.
    ykeys: ['total'],
    // Labels for the ykeys -- will be displayed when you hover over the
    // chart.
    labels: ['Flights']
    });
    </script>
    <script type="text/javascript">
    var json = (function () {
    		 var json = null;
    		 $.ajax({
    				 'async': false,
    				 'global': false,
    				 'url': "<?php echo actionurl('/pilots/morrisstatsaircraftdata/'.Auth::$userinfo->pilotid.'');?>",
    				 'dataType': "json",
    				 'success': function (data) {
    						 json = data;
    				 }
    		 });
    		 return json;
     })
     ();
    
    Morris.Donut({
    element: 'aircraftdata',
    data: json
    });
    </script>
    

    The end result http://imgur.com/wyb2lUz

    Thanks to Vangelis for providing most of the base code.

    • Like 1
  4. It should work out of the box, but you could try going into PopUpNewsData.class.php and changing these

    public function popupnewsitem($id)
    public function get_news_list($howmany) {
    

    To these

    public static function popupnewsitem($id)
    public static function get_news_list($howmany) {
    

  5. In your other post you mentioned that the jquery version is conflicting between the one compatible with phpVMS and the one in your skin, I tried the following and it seems to work without breaking the skin, you will get an error in firebug stating that you need jquery 1.9.1 or higher for bootstrap, but from what I can see, nothing has broken yet and this also brings back functionality of the accepting/rejecting PIREPS and viewing the Pilots/schedules which weren't possible with your version of jquery.

    ...

    Go into your admin/lib/layout/footer.php and find these lines:

    <!-- jQuery 2.1.4 -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <!-- jQuery UI 1.11.4 -->
    <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
    

    and then move them into admin/templates/core_htmlhead.php so that it is read on every page

    Once done, change the jquery version to an earlier one which is compatible with phpVMS in this case I've tried it with 1.8.3 and the skin hasn't broken

    So you should end up like this

    <!-- jQuery 2.1.4 -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <!-- jQuery UI 1.11.4 -->
    <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
    

    In your admin/templates/core_htmlhead.php

    If you do need some bootstrap functions (e.g. dropdowns), then you may need to change a few core files which isn't recommended.

    Otherwise you can google newer versions of the javascript files e.g. jquery.jqgrid.min.js, etc.) and place them into the corresponding position in the phpvms layout (lib/js...) and then replace the above code with a newer version of jQuery (e.g. 1.11.3)

    And to fix your log-on-refresh issue,

    open bootstrap.js and before your last

    }(jQuery);
    

    (very end of the page)

    and then put this there

     // Clear Modal On Hide
     // ===================
       // no cache data loaded to modal popup (by default it's cached)
       $('body').on('hidden.bs.modal', '.modal', function (event) {
        $(this).removeData('bs.modal');
       });
    

    Then change all your references of

    bootstrap.min.js
    

    to

    bootstrap.js
    

    unless you want to minify it first.

  6. If you go to your admin panel, then to site & settings then to profile fields and select Show In User Profile.

    If you don't have the code for that, then verify that you've spelt the field correctly and put this

    <?php
    $fieldvalue1 = PilotData::GetFieldValue($userinfo->pilotid, 'STATION_CALLSIGN');
    ?> <?php echo $fieldvalue1; ?>
    

    Because the above code works for me. And in regards to your last question, as long as you have got information for the user you are logged in as, it will show.

×
×
  • Create New...