Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ have is:

require './shiftplanning.php';

$shiftplanning = new shiftplanning(
$shiftplanning = new Shiftplanning(
array(
'key' => 'XXXXXXXXXXXXXXXXXX' // enter your developer key
)
Expand Down
145 changes: 74 additions & 71 deletions examples/examples.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php

// require the ShiftPlanning SDK class
require('./shiftplanning.php');
require('../src/shiftplanning.php');

/* set the developer key on class initialization */
$shiftplanning = new shiftplanning(
$shiftplanning = new Shiftplanning(
array(
'key' => 'XXXXXXXXXXXXXXXXXX' // enter your developer key
)
);

// or set the developer key using the setAppKey method
//$shiftplanning->setAppKey( 'XXXXXXXXXXXXXXXXXX' );
//$shiftplanning->setAppKey('XXXXXXXXXXXXXXXXXX');

/**
*
Expand All @@ -22,13 +22,14 @@

// check for a current active session
// if a session exists, $session will now hold the user's information
$session = $shiftplanning->getSession( );
$session = $shiftplanning->getSession();

echo "appKey: " . $shiftplanning->getAppKey( ) . "<br/>"; // returns the developer key currently set
echo "appToken: " . $shiftplanning->getAppToken( ) . "<br/>"; // returns the token for the current session, error if not yet set

if( !$session )
{// if a session hasn't been started, create one
if (!$session)
{
// if a session hasn't been started, create one

// perform a single API call to authenticate a user
$response = $shiftplanning->doLogin(
Expand All @@ -38,7 +39,7 @@
)
);

if( $response['status']['code'] == 1 )
if ($response['status']['code'] == 1)
{// check to make sure that login was successful
$session = $shiftplanning->getSession( ); // return the session data after successful login
echo "Hi, " . $session['employee']['name'] . "<br/>";
Expand All @@ -49,79 +50,80 @@
}
}
else
{// session has been established
{
// session has been established

// the $session variable now holds the currently logged in user's data
echo "Hi, " . $session['employee']['name'] . "<br/>";

/**
* Quick Access ShiftPlanning SDK Methods:
* doLogin( $array_of_user_data )
* doLogout( )
* getMessages( )
* getMessageDetails( $message_id )
* createMessage( $array_of_message_data )
* deleteMessage( $message_id )
* getWallMessages( )
* createWallMessage( $array_of_message_data )
* deleteWallMessage( $message_id, $array_of_other_message_data )
* getEmployees( )
* getEmployeeDetails( $employee_id_number )
* updateEmployee( $employee_id, $array_of_updated_employee_data )
* createEmployee( $array_of_employee_data )
* deleteEmployee( $employee_id )
* getStaffSkills( )
* getStaffSkillDetails( $skill_id )
* createStaffSkill( $array_of_skill_data )
* updateStaffSkill( $skill_id, $array_of_skill_data )
* deleteStaffSkill( $skill_id )
* createPing( $array_of_ping_data )
* getSchedules( )
* getScheduleDetails( $schedule_id )
* createSchedule( $array_of_schedule_data )
* updateSchedule( $schedule_id, $array_of_schedule_data )
* deleteSchedule( $schedule_id )
* getShifts( )
* getShiftDetails( $shift_id )
* updateShift( $shift_id, $array_of_shift_data )
* createShift( $array_of_shift_data )
* deleteShift( $shift_id )
* getVacationSchedules( $time_period_array ) // e.g. getVacationSchedules( array( 'start' => '', 'end' => '' ) );
* getVacationScheduleDetails( $schedule_id )
* createVacationSchedule( $array_of_schedule_data )
* updateVacationSchedule( $schedule_id, $array_of_schedule_data )
* deleteVacationSchedule( $schedule_id )
* getScheduleConflicts( )
* getAdminSettings( )
* updateAdminSettings( $array_of_new_settings )
* getAdminFiles( )
* getAdminFileDetails( $file_id )
* updateAdminFile( $file_id, $array_of_file_data )
* createAdminFile( $array_of_file_data )
* deleteAdminFile( $file_id )
* getAdminBackups( )
* getAdminBackupDetails( $backup_id )
* createAdminBackup( $array_of_backup_data )
* deleteAdminBackup( $backup_id )
* getAPIConfig( )
* getAPIMethods( )
* doLogin($array_of_user_data)
* doLogout()
* getMessages()
* getMessageDetails($message_id)
* createMessage($array_of_message_data)
* deleteMessage($message_id)
* getWallMessages()
* createWallMessage($array_of_message_data)
* deleteWallMessage($message_id, $array_of_other_message_data)
* getEmployees()
* getEmployeeDetails($employee_id_number)
* updateEmployee($employee_id, $array_of_updated_employee_data)
* createEmployee($array_of_employee_data)
* deleteEmployee($employee_id)
* getStaffSkills()
* getStaffSkillDetails($skill_id)
* createStaffSkill($array_of_skill_data)
* updateStaffSkill($skill_id, $array_of_skill_data)
* deleteStaffSkill($skill_id)
* createPing($array_of_ping_data)
* getSchedules()
* getScheduleDetails($schedule_id)
* createSchedule($array_of_schedule_data)
* updateSchedule($schedule_id, $array_of_schedule_data)
* deleteSchedule($schedule_id)
* getShifts()
* getShiftDetails($shift_id)
* updateShift($shift_id, $array_of_shift_data)
* createShift($array_of_shift_data)
* deleteShift($shift_id)
* getVacationSchedules($time_period_array) // e.g. getVacationSchedules(array('start' => '', 'end' => ''));
* getVacationScheduleDetails($schedule_id)
* createVacationSchedule($array_of_schedule_data)
* updateVacationSchedule($schedule_id, $array_of_schedule_data)
* deleteVacationSchedule($schedule_id)
* getScheduleConflicts()
* getAdminSettings()
* updateAdminSettings($array_of_new_settings)
* getAdminFiles()
* getAdminFileDetails($file_id)
* updateAdminFile($file_id, $array_of_file_data)
* createAdminFile($array_of_file_data)
* deleteAdminFile($file_id)
* getAdminBackups()
* getAdminBackupDetails($backup_id)
* createAdminBackup($array_of_backup_data)
* deleteAdminBackup($backup_id)
* getAPIConfig()
* getAPIMethods()
*/

/**
* All Quick-Access methods return a response like this:
* array(
* 'status' => array( 'code' => '1', 'text' => 'Success', 'error' => 'Error message if any' ),
* 'status' => array('code' => '1', 'text' => 'Success', 'error' => 'Error message if any'),
* 'data' => array(
* 'field_name' => 'value'
* )
* )
*
* For methods that return multiple objects (as in the case for the getMessages( ) method
* For methods that return multiple objects (as in the case for the getMessages() method
* responses will look like this, where the indexes [0], [1] would be replaced with the
* message you're looking to display
*
* array(
* 'status' => array( 'code' => '1', 'text' => 'Success', 'error' => 'Error message if any' ),
* 'status' => array('code' => '1', 'text' => 'Success', 'error' => 'Error message if any'),
* 'data' => array(
* [0] => array (
* 'id' => 1,
Expand All @@ -136,7 +138,7 @@
*/

// Quick-Access Methods, to perform API calls more easily
$employees = $shiftplanning->getEmployees( ); // returns all employees
$employees = $shiftplanning->getEmployees(); // returns all employees
$employee_1_wage = $employees['data'][0]['wage'];
echo "Employee 1 Wage: $" . $employee_1_wage . "<br/>";
echo "Employee 1 Nick Name: " . $employees['data'][0]['nick_name'] . "<br/>";
Expand All @@ -149,7 +151,7 @@
)
);

if( $update_employee_record_response['status']['code'] == 1 )
if ($update_employee_record_response['status']['code'] == 1)
{// employee update successful
echo "Employee record updated.<br/>";
}
Expand Down Expand Up @@ -216,16 +218,17 @@

}

if( $get_schedules['status']['code'] == 1 )
{// schedules were retrieved successfully
print_r( $get_schedules['data'][0] ); // print data from first schedule returned
// schedules were retrieved successfully
if ($get_schedules['status']['code'] == 1)
{
print_r($get_schedules['data'][0]); // print data from first schedule returned
}

if( $get_settings['status']['code'] == 1 )
{// admin settings retrieved successfully
print_r( $get_settings );
// admin settings retrieved successfully
if ($get_settings['status']['code'] == 1)
{
print_r($get_settings);
}

//$shiftplanning->doLogout();
}
?>
$shiftplanning->doLogout();
}
141 changes: 141 additions & 0 deletions src/config/mimes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?php
/**
* A list of mime types.
*/
return array(
"ez" => "application/andrew-inset",
"hqx" => "application/mac-binhex40",
"cpt" => "application/mac-compactpro",
"doc" => "application/msword",
"bin" => "application/octet-stream",
"dms" => "application/octet-stream",
"lha" => "application/octet-stream",
"lzh" => "application/octet-stream",
"exe" => "application/octet-stream",
"class" => "application/octet-stream",
"so" => "application/octet-stream",
"dll" => "application/octet-stream",
"oda" => "application/oda",
"pdf" => "application/pdf",
"ai" => "application/postscript",
"eps" => "application/postscript",
"ps" => "application/postscript",
"smi" => "application/smil",
"smil" => "application/smil",
"wbxml" => "application/vnd.wap.wbxml",
"wmlc" => "application/vnd.wap.wmlc",
"wmlsc" => "application/vnd.wap.wmlscriptc",
"bcpio" => "application/x-bcpio",
"vcd" => "application/x-cdlink",
"pgn" => "application/x-chess-pgn",
"cpio" => "application/x-cpio",
"csh" => "application/x-csh",
"dcr" => "application/x-director",
"dir" => "application/x-director",
"dxr" => "application/x-director",
"dvi" => "application/x-dvi",
"spl" => "application/x-futuresplash",
"gtar" => "application/x-gtar",
"hdf" => "application/x-hdf",
"js" => "application/x-javascript",
"skp" => "application/x-koan",
"skd" => "application/x-koan",
"skt" => "application/x-koan",
"skm" => "application/x-koan",
"latex" => "application/x-latex",
"nc" => "application/x-netcdf",
"cdf" => "application/x-netcdf",
"sh" => "application/x-sh",
"shar" => "application/x-shar",
"swf" => "application/x-shockwave-flash",
"sit" => "application/x-stuffit",
"sv4cpio" => "application/x-sv4cpio",
"sv4crc" => "application/x-sv4crc",
"tar" => "application/x-tar",
"tcl" => "application/x-tcl",
"tex" => "application/x-tex",
"texinfo" => "application/x-texinfo",
"texi" => "application/x-texinfo",
"t" => "application/x-troff",
"tr" => "application/x-troff",
"roff" => "application/x-troff",
"man" => "application/x-troff-man",
"me" => "application/x-troff-me",
"ms" => "application/x-troff-ms",
"ustar" => "application/x-ustar",
"src" => "application/x-wais-source",
"xhtml" => "application/xhtml+xml",
"xht" => "application/xhtml+xml",
"zip" => "application/zip",
"au" => "audio/basic",
"snd" => "audio/basic",
"mid" => "audio/midi",
"midi" => "audio/midi",
"kar" => "audio/midi",
"mpga" => "audio/mpeg",
"mp2" => "audio/mpeg",
"mp3" => "audio/mpeg",
"aif" => "audio/x-aiff",
"aiff" => "audio/x-aiff",
"aifc" => "audio/x-aiff",
"m3u" => "audio/x-mpegurl",
"ram" => "audio/x-pn-realaudio",
"rm" => "audio/x-pn-realaudio",
"rpm" => "audio/x-pn-realaudio-plugin",
"ra" => "audio/x-realaudio",
"wav" => "audio/x-wav",
"pdb" => "chemical/x-pdb",
"xyz" => "chemical/x-xyz",
"bmp" => "image/bmp",
"gif" => "image/gif",
"ief" => "image/ief",
"jpeg" => "image/jpeg",
"jpg" => "image/jpeg",
"jpe" => "image/jpeg",
"png" => "image/png",
"tiff" => "image/tiff",
"tif" => "image/tif",
"djvu" => "image/vnd.djvu",
"djv" => "image/vnd.djvu",
"wbmp" => "image/vnd.wap.wbmp",
"ras" => "image/x-cmu-raster",
"pnm" => "image/x-portable-anymap",
"pbm" => "image/x-portable-bitmap",
"pgm" => "image/x-portable-graymap",
"ppm" => "image/x-portable-pixmap",
"rgb" => "image/x-rgb",
"xbm" => "image/x-xbitmap",
"xpm" => "image/x-xpixmap",
"xwd" => "image/x-windowdump",
"igs" => "model/iges",
"iges" => "model/iges",
"msh" => "model/mesh",
"mesh" => "model/mesh",
"silo" => "model/mesh",
"wrl" => "model/vrml",
"vrml" => "model/vrml",
"css" => "text/css",
"html" => "text/html",
"htm" => "text/html",
"asc" => "text/plain",
"txt" => "text/plain",
"rtx" => "text/richtext",
"rtf" => "text/rtf",
"sgml" => "text/sgml",
"sgm" => "text/sgml",
"tsv" => "text/tab-seperated-values",
"wml" => "text/vnd.wap.wml",
"wmls" => "text/vnd.wap.wmlscript",
"etx" => "text/x-setext",
"xml" => "text/xml",
"xsl" => "text/xml",
"mpeg" => "video/mpeg",
"mpg" => "video/mpeg",
"mpe" => "video/mpeg",
"qt" => "video/quicktime",
"mov" => "video/quicktime",
"mxu" => "video/vnd.mpegurl",
"avi" => "video/x-msvideo",
"movie" => "video/x-sgi-movie",
"ice" => "x-conference-xcooltalk",
);
16 changes: 16 additions & 0 deletions src/messages/internal_error.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/**
* A list of internal error messages
*/
return array(
0 => 'Could not find the requested error message.',
1 => 'The requested API method was not found in this SDK.',
2 => 'The ShiftPlanning API is not responding.',
3 => 'You must use the login method before accessing other modules of this API.',
4 => 'A session has not yet been established.',
5 => 'You must specify your Developer Key when using this SDK.',
6 => 'The ShiftPlanning SDK needs the CURL PHP extension.',
7 => 'The ShiftPlanning SDK needs the JSON PHP extension.',
8 => "File doesn't exist.",
9 => 'Could not find the correct mime for the file supplied.',
);
Loading