Jump to content

Wingthor

Members
  • Posts

    44
  • Joined

  • Last visited

Posts posted by Wingthor

  1. Well currently i was looking at the possibility of creating a script that looked at the hours and added awards accordingly, this was based on a cron job nightly.

    A cron task will do the job, for those who has linux based server. Not sure about those with a windows based server...

  2. You just need to add a file in, you're calling a URL which doesn't exist.

    Like so:

    document.getElementById("main_time").innerHTML = <?php $SITE_URL . "action.php/mymodule/getGmt"; ?>;

    That will insert your module content into the div excluding all the layout.tpl code you would normally get.

    Ok, that helped me alot. The php variant returns blank, but putting the action.php into the XMLHttpRequest.open method's URL works perfect. Now the XMLHttpRequest responseText returns what I want and nothing more!

    Thanks alot!!! :D

    Regards

  3. Then you understand twice as much as me :rolleyes: You must understand AJAX to understand.

    As we speak I have tried an other method which seems to give med the same result:

    document.getElementById("main_time").innerHTML = <?php $SITE_URL . "/mymodule/getGmt"; ?>;

    Seems like something happens when I use URL directly to the php file. The tag returns empty. Seems like I must build an independently library file. Anyone?

  4. Uh, don't understand half of what you said, but I'm guessing the gist of it is you want to just show the page rather than the headers etc.

    Solution: action.php

    Then you understand twice as much as me :rolleyes: You must understand AJAX to understand.

    As we speak I have tried an other method which seems to give med the same result:

    document.getElementById("main_time").innerHTML = <?php $SITE_URL . "/mymodule/getGmt"; ?>;

  5. I am building a module for PHPVms which I wan't to be AJAX driven. When passing an URL through the to the PHPVms website by a XMLHttpRequest, I want my module's public function to 'echo' a variable to the Javascript. But phpvms send all the headers and the whole site again, even if the modules function only echoes out a variable. Is there a way to prevent phpvms to resend the whole page?

    I am using the open method with GET, url and async = true. And I am receiving responseText, which I only wan't to be an variable used in an innerHTML tag. The PHP function is just echo "blah blah blal";

    Can anyone help me with this?

    Regards.

    Wingthor.

  6. Unfortunatley I can not run the new function. I am getting a return of

    Even though the user has all privileges available.

    Also there is a miss-type in your query. You are calling the function as "GreaterCircDistNm" but in the create you call it "GreaterCircleNm". Easy fix to rename but just thought you would like to know.

    Which version of MySql do you have. http://dev.mysql.com/doc/refman/5.1/en/stored-programs-logging.html

    I works fine on my MySql 5.0.75.

  7. Very Cool Wing. How do you create the function? Run in the SQL window in phpAdmin?

    Can you give detailed info?

    Yes, run as SQL... And add fucntion before QRY's. As you can see the QRY use calls to the function.

    You need directly access to the DB as this is pure SQL. So if you have phpMyAdmin paste in as SQL and run it. I don't have phpMySQL, right now. So my instruction can only be bried. But as I remember there was an option to run SQL on a DB when you have selected it. But im sure there is experienced phpMyAdmins users on the forum which can give more detailed instruction on how to run SQL from phpMyAdmin.

    Check this http://community.mybb.com/thread-4720.html I can't verify of mentions reasons...

  8. Well since no one came up with a link, I had to find my own solution which I think i so briliant that I will share it with you. Adding schedules is a hack, adding airports is not. An obvousily you don't want a schedule for an airport that is not in your DB. Most of you will have accsess to send queries directly to the DB by, webmin, phpmyadmin heidi sql or even odbc.

    So why don't add the greatcircle formula to the phpvms DB, and get the airports data straigt from the DB.

    SET GLOBAL log_bin_trust_function_creators=TRUE; 
    
    DROP FUNCTION IF EXISTS GreaterCircleNm;
    DELIMITER go
    CREATE FUNCTION GreaterCircleNm( lat1 FLOAT, lon1 FLOAT, lat2 FLOAT, lon2 FLOAT ) RETURNS float
    BEGIN
     DECLARE pi, q1, dist FLOAT;
     SET pi = PI();
     SET lat1 = lat1 * pi / 180;
     SET lon1 = lon1 * pi / 180;
     SET lat2 = lat2 * pi / 180;
     SET lon2 = lon2 * pi / 180;
    SET q1 = ACOS(sin(lat1)*sin(lat2)+COS(lat1)*COS(lat2)*COS(lon1-lon2));
    SET dist = q1*180*60/pi;
    RETURN dist;
    END;
    go
    DELIMITER ;

    Make sure it goes in your phpvms DB.

    So I lets say I wan't generate routes to and from all the airports in my DB...

     SELECT
       NULL,
       depart.icao,
       arrive.icao,
       ROUND(GreaterCircDistNm(depart.lat,depart.lng,arrive.lat,arrive.lng),2) as Nm
    FROM airports AS depart
    INNER JOIN airports AS arrive ON depart.icao <> arrive.icao

    There you go now you have a node between every node in you selection which easely can be exported as CVS.

    But just to show the briliance.

    I have a aircraft which has a limit on 1000NM, I whish the plane to be station at London HTRW. 'EGLL'....

    Well into the QRY it goes...

    SELECT
       NULL,
       depart.icao,
       arrive.icao,
       ROUND(GreaterCircDistNm(depart.lat,depart.lng,arrive.lat,arrive.lng),2) as Nm
    FROM airports AS depart
    INNER JOIN airports AS arrive ON depart.icao <> arrive.icao
    where depart.icao = 'EGLL'
    HAVING Nm <= 1000;

    And there you have a circle. Get it into your sheet template, and sky is the limit.....

    Regards...

  9. I have read the API's documentataion regarding sending variables to scrips using the URL. Like index.php/moduletest/pageone/apple/red Gives the varible 'apple' the value 'red' to the script function pageone

    However I wan't a module to remember the setting, while fetching an other variable, like /beer/isgood.

    Next time the page is loaded the scripts remember that the user already has seleced red apples, when the user select the option beer is good. Then can process a page based on these settings? I am gone use this for creating dynamic SQL's where the where clause might cange, in terms of value and number of criterias given.

    Eg, first click filters on pilotid, next click filter on bids, and so on.

    Regards

  10. What I don't understand is why people are pulling data from the schedules table in the first place. This isn't making sense, it doesn't seem to update correctly. Why wouldn't you pull it from the acarsdata table??

    I tried all day and its obvious that i suck at php......

    Don't know, guess they want to see upcoming flights? I would choose from both, and perhaps even bids.

    Did it work?

  11. Got it to show, but now its old flights. I want live. I had the database prefixes wrong.

    I might talk over my head now, but you can try to change the "from" clause in the SQL you are using to acarsdata.

    SELECT * FROM acarsdata ORDER BY deptime + 0 ASC

    And see if you get any...

    Perhaps also after $list = DB::get_results($query);

    if (empty($list))
    {
    echo "No one is flying to day";
    exit;
    }

    But you are on your own here...

  12. I am not sure if this would help, but in my phpvms DB the table for schedules is named schedules not phpvms_schedules, so check it out. Guess you get that error since array list$ is empty, due to the naming error of the table in the SQL.

    To get date converted. You seem to not need all the fields in the query, use rather this selec function:

    select id, depicao, arricao, date_format(convert_TZ(concat(curdate()," ", left(deptime,5)) , '+00:00','+2:00'),'%T') as 'deptime',
    date_format(convert_TZ(concat(curdate()," ", left(arrtime,5)), '+00:00','+2:00'),'%T') as 'arrtime', aircraft, daysofweek from schedules
    where instr(daysofweek,'6')>0 order by arrtime ASC

    Make a php variable which finds out which day of week it is, and convert to a value that fits in with the daysofweek field.

    <$php $curday=cal_to_jd(CAL_GREGORIAN,date("m"),date("d"),date("Y")); ?>

    or something... and put $curday in to where clause rather than six. This query will select all flight for a saturday.

    To convert the time to local, change the timenumbera after the both '+' om the sql. The first is the time relative to GMT and second is your relative to GMT.

    I have not testet other than as pure SQL directly on the server. So test at own risk.

    Regards

  13. Think I will just make a module which parses to the exisitng awards table. But also make an verify option, so you actually have to confirm the award before actually given. So that the module will be more like a "awards recomendation" thing. It's kind of an irreversible ting, you don't withdraw an award likely.

    OT: (Like your logo though, FLST here...)

  14. Sorry didn't explain fully, i want that data on another page but i cant include it as it needs to be ran as a url,

    Yes, you have to change to URL. Assumingen the files has been copied in the directories as described, you just add /index.php/TouchdownStats/top_landing_this_month to you site's URL. When I click on the URL you sent the page comes up fine?

    Regards

  15. Since my database is quite sparse, I am not sure, but I think the following sql will give you best landing grouped by month and pilot for a given year. You can test if you have webmin, phpmyadmin or heidi SQl Whatevere. Perhaps that is interestning?

    SELECT pilotid, date_format(submitdate,'%M') as month, code, flightnum, depicao, arricao, aircraft, max(landingrate) as 'best landing', format(avg(landingrate),2) as 'average', submitdate FROM `pireps` 
    group by month(submitdate),(pilotid) having year(submitdate)=2011 

    Change year to whatever you like...

×
×
  • Create New...