Jump to content

Leave Of Absence v0.9


Sava

Recommended Posts

A few post up you can see

http://forum.phpvms...._40#entry111780

protected function check ($version)
	 {
	 $version_to_check = $version;
// make the cURL request
$curl = curl_init('http://www.savamarkovic.com/loa.csv');
curl_setopt($curl, CURLOPT_FAILonerror, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$read = curl_exec($curl);
	 if ($read[0] > $version_to_check && $read[2] == "1") { $critical = TRUE; } // If its 1, set ciritcal to true
	 if ($read[0] > $version_to_check) { $update = TRUE; } // Anything other than 1 set update to true
	 if ($read[0] == $version_to_check) {
			 echo '<p id="success">Your version of this module is up to date. Wohooooo! )</p>';
	 }else if ($critical) {
					 echo '<h4>CRITICAL UPDATE FOUND!</h4>';
					 echo '<p id="error">There is a critical update available! Here is the information associated with the update. <br/><b>Version:
							 '.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';
	 }else if ($update){
					 echo '<h4>NON CRITICAL UPDATE FOUND!</h4>';
					 echo '<p id="error" style="background:#fffca7;border-color:orange">There is NON critical update available! Here is the information associated with the update. <br/><b>Version:
							 '.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';
	 }
}

Link to comment
Share on other sites

  • 2 weeks later...

Leave of Absence Admin

There are no LoA requests.

Warning: curl_setopt() expects parameter 2 to be long, string given in /home4/jroggjr/public_html/admin/modules/LoA/LoA.php on line 83

Here is line 83 curl_setopt($curl, CURLOPT_FAILonerror, true);

NON CRITICAL UPDATE FOUND!

There is NON critical update available! Here is the information associated with the update.

Version: < - !

Please send an email to ceo@airserbiavirtual.com to receive the updated version.

If I change the onerror to onerror the errors go away but I no longer get the update box either. The onerror should be all caps, but for some damn reason this thing won't capitalize them.

Link to comment
Share on other sites

  • Administrators

Why not use the native cURL wrapper in phpVMS?

Instead of;

// make the cURL request
$curl = curl_init('http://www.savamarkovic.com/loa.csv');
curl_setopt($curl, CURLOPT_FAILonerror, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$read = curl_exec($curl);

try;

$url = 'http://www.savamarkovic.com/loa.csv';
$file = new CodonWebService();
$read = @$file->get($url);

Link to comment
Share on other sites

  • 4 months later...

There are no LoA requests.

Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /membri/wwwcubanavirtual/phpvms/admin/modules/LoA/LoA.php on line 83

Warning: fclose(): supplied argument is not a valid stream resource in /membri/wwwcubanavirtual/phpvms/admin/modules/LoA/LoA.php on line 84

any help, thanks

Link to comment
Share on other sites

  • Administrators

There are no LoA requests.

Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /membri/wwwcubanavirtual/phpvms/admin/modules/LoA/LoA.php on line 83

Warning: fclose(): supplied argument is not a valid stream resource in /membri/wwwcubanavirtual/phpvms/admin/modules/LoA/LoA.php on line 84

any help, thanks

Answer is right above your post. The page it is looking for is not there - 404 error

Link to comment
Share on other sites

Why not use the native cURL wrapper in phpVMS?

Instead of;

// make the cURL request
$curl = curl_init('http://www.savamarkovic.com/loa.csv');
curl_setopt($curl, CURLOPT_FAILonerror, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$read = curl_exec($curl);

try;

$url = 'http://www.savamarkovic.com/loa.csv';
$file = new CodonWebService();
$read = @$file->get($url);

I already post for that copy/paste this in your admin/modules/LoA/LoA.php

<?php
/**
* Leave of Absence (LoA) v.1.0 Module
*
* phpVMS Module for pilots to submit a LoA request that is stored in a database
* and an option for staff to view all the LoA requests through the admin panel
* This module is released under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
* You are free to redistribute and alter this work as you wish but you must keep the original 'copyright' information on all the places it comes in the original work.
* You are not allowed to delete the copyright information and/or gain any profit by adopting or using this module.
*
* @author Sava Markovic - savamarkovic.com
* @copyright Copyright (c) 2012, Sava Markovic
* @link http://www.savamarkovic.com
* @license http://creativecommons.org/licenses/by-nc-sa/3.0/
*/
class LoA extends CodonModule {
public $title = "Leave of Absence Admin";

public function HTMLHead()
 {
	 $this->set('sidebar', 'loa/loa_admin_sidebar.tpl');
 }
public function NavBar ()
 {
	 echo '<li><a href="'.SITE_URL.'/admin/index.php/LoA">LoA Admin</a></li>';
 }
public function index ()
{
 $version = '1.0';
 $leaves = LoAData::GetAllRequests(array());
 $this->set('all_leaves', $leaves);
 $this->render('loa/loa_admin_index.tpl');
 $this->check($version);
 }
 public function viewLOA()
 {
 $id = $this->get->id;	
 $getinfo = LoAData::GetInfoByID($id);
 $this->set('info', $getinfo);
 $this->render('loa/loa_admin_view_request.tpl');
 }
 public function confirmDeleteLOA()
 {
 $id = $this->get->id;	
 $getinfo = LoAData::GetInfoById($id);
 $this->set('info', $getinfo);
 $this->render('loa/loa_admin_confirm_delete_request.tpl');
 }
 public function deleteLOA()
 {
 $id = $this->get->id;
 $getinfo = LoAData::DeleteLoA($id);

 if (mysql_affected_rows() == -1)
 {
	 $this->set('message', 'The LoA Reqest hasn\'t been deleted from the database for some reason. This isn\'t suppose to happen. Check the phpVMS forums for support.');
	 $this->render('loa/loa_admin_delete_request.tpl');
 }
 else
 {

	 $this->set('message', 'The LoA Reqest has been successfuly deleted from the database.');
	 $this->render('loa/loa_admin_delete_request.tpl');
 }

 }
protected function check ($version)
			 {
			 $version_to_check = $version;
// make the cURL request
$url = 'http://www.savamarkovic.com/loa.csv';
$file = new CodonWebService();
$read = @$file->get($url);
			 if ($read[0] > $version_to_check && $read[2] == "1") { $critical = TRUE; } // If its 1, set ciritcal to true
			 if ($read[0] > $version_to_check) { $update = TRUE; } // Anything other than 1 set update to true
			 if ($read[0] == $version_to_check) {
							 echo '<p id="success">Your version of this module is up to date. Wohooooo! )</p>';
			 }else if ($critical) {
											 echo '<h4>CRITICAL UPDATE FOUND!</h4>';
											 echo '<p id="error">There is a critical update available! Here is the information associated with the update. <br/><b>Version:
															 '.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';
			 }else if ($update){
											 echo '<h4>NON CRITICAL UPDATE FOUND!</h4>';
											 echo '<p id="error" style="background:#fffca7;border-color:orange">There is NON critical update available! Here is the information associated with the update. <br/><b>Version:
															 '.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';
			 }
}
}

Link to comment
Share on other sites

  • 1 year later...

Jut installed this with ver 5.5 running. on the Pilot Side emails being sent ok,2 issues. How can the pilot select a start date? and the following errors are shown, no data being sent to DB.

Strict Standards: Non-static method LoAData::CheckPilotID() should not be called statically, assuming $this from incompatible context in /var/www/vhosts/......com/core/modules/LoA/LoA.php on line 66

Deprecated: mysql_query(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/www/vhosts//......com.com/core/common/LoAData.class.php on line 24

Warning: mysql_query(): Access denied for user ''@'localhost' (using password: NO) in /var/www/vhosts//......com.com/core/common/LoAData.class.php on line 24

Warning: mysql_query(): A link to the server could not be established in /var/www/vhosts//......com.com/core/common/LoAData.class.php on line 24

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /var/www/vhosts//......com.com/core/common/LoAData.class.php on line 25

Strict Standards: Non-static method LoAData::AddLoa() should not be called statically, assuming $this from incompatible context in /var/www/vhosts//......com.com/core/modules/LoA/LoA.php on line 76

Your leave of absence request has been submitted. You will recieve an email confirming your details. There is no further action required on your part.

On the ADmin page:

Strict Standards: Non-static method LoAData::GetAllRequests() should not be called statically, assuming $this from incompatible context in /var/www/vhosts/......com.com/admin/modules/LoA/LoA.php on line 35

Any fixes?

Thanks

Thank you!

Link to comment
Share on other sites

  • 2 months later...

I just installed this module, i got following issues :

Admin Panel :

Strict Standards: Non-static method LoAData::GetAllRequests() should not be called statically, assuming $this from incompatible context in /home/vaemirat/public_html/admin/modules/LoA/LoA.php on line 35

On the site, where it should show up :

Notice: The template file "/home/vaemirat/public_html/core/templates/loa/loa_index.php" doesn't exist in /home/vaemirat/public_html/core/classes/TemplateSet.class.php on line 231

Can anyone please help me out ??

Link to comment
Share on other sites

  • 4 months later...

The connections are deprecated.

mysql_query(): is now mysqli_query()

But that gets a tad complicated.

You can rewrite it ass PDO.

Also everything to go with that connect is deprecated as well.

mysql_num_rows() is now mysqli_num_rows()

Same thing with the connection error. Etc etc. Basically this module needs help. The code it runs on was deprecated. "This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used." php Manual

I'm working on it but I suck at this stuff. I fixed this issue once on another module and not sure how I did it now.

Check this out too

mysqli_query is now used instead of mysql_query. You can also use PDO::query or MySQLi::query. You can see the documentation here

Link to comment
Share on other sites

Hello everyone.

This module has been written a long time ago, and even then it was far from perfect. I believe there is a newer version I did a few months after the initial one and never uploaded it to GitHub. I'll check and upload if so.

Edited by Sava
Link to comment
Share on other sites

I have been fiddling with this for a couple hours and no such love. I fixed this issue once before in another project I was working on like it was nothing. Now, it is nothing lol as I can not fix it. I am going to loose sleep over it now. I am REAL OCD like that. :wacko:

I sounded a couple of alarms for help from people I know. Hopefully someone will chime in and help us all out.

Link to comment
Share on other sites

Everything works flawless and looks good except, when I applied for LoA as a test pilot, I logged out, cleared cookies and cache and then logged back in as admin. I went in and viewed said pilots request and hit delete. After delete, it said are you sure. i clicked delete and nothing happens it just stays on the very same page. goes nowhere and pilot is not deleted from the database. If I click no, that I do not want to delete the request, it also stays on that page and does nothing. that's as far as it will go. I did test all errors that were testable and all worked such as already exists, date is to long etc etc.

I am going to go back now and try to approve a pilots leave of absence. I will come report back if approval is successful.

On a side note, all database connection errors are gone as well as deprecated code errors.

Link to comment
Share on other sites

Oh ok. I see no approval is needed for leave of absence.

You are viewing the Leave of Absence Request for pilot The pilot's leave started on the following date: 12/09/2016

The pilot's leave will end on the following date:12/31/2016

The pilot has specified the following reason for submitting the LoA request:

I left the reason off for a very good reason. it might have had a swear word in it. lol

Link to comment
Share on other sites

I found a very minor error in the module in the admin panel.

When a pilot sends in a request and you click view, it is supposed to display the pilots name and profile link and it does not. Also on confirm deletion of LoA request, it does not display the pilot id neither.

However, it does display the pilots name and pilot id number properly on LoA Admin Index page

Quote

You are viewing the Leave of Absence Request for pilot  (missing PID and link)
The pilot's leave started on the following date: 12/17/2016
The pilot's leave will end on the following date:01/30/2017
The pilot has specified the following reason for submitting the LoA request:

Hi Ray testing email

Quote

Delete A Leave of Absence Request

Are you sure you want to delete a LoA Request for pilot (Missing PID and Link)

 

Edited by TAV1702
Additional Info
Link to comment
Share on other sites

  • Administrators
4 hours ago, TAV1702 said:

hey real quick while I have this file open and before I forget what I was going to ask, in this piece of code :


private static $maxDuration  = 61;

 

I change the 61 to what ever number I wish such as 90 for 90 days correct?

I may have a slightly newer version than you Ray. At the end of that line, mine states: // Edit this value to set the max LOA Duration

I think (as in I'm not positive) you would set it to the number of days - plus 1 day. So if you limit an LOA to 90 days, it will expire on day 91. This provides the pilot a full 90 days of LOA.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...