/** * Get the name of the resource being accessed * * @return String */ function getActionforACL() { $action = strtolower($this->getRequest()->getActionName()); if ($action == "history" || ($action = "historysearch" || ($action = "changedays" || ($action = "complete")))) { return ACTION_LIST; } if ($action == "issuepayslips") { } return parent::getActionforACL(); }
public function getActionforACL() { $action = strtolower($this->getRequest()->getActionName()); if ($action == "updatestatus") { return ACTION_EDIT; } if ($action == "events" || $action == "calendar") { return ACTION_VIEW; } return parent::getActionforACL(); }
/** * Override unknown actions to enable ACL checking * * @see SecureController::getActionforACL() * * @return String */ public function getActionforACL() { $action = strtolower($this->getRequest()->getActionName()); if ($action == "request" || $action == "processrequest" || $action == "upload") { return ACTION_VIEW; } if ($action == "approve" || $action == "forapproval") { return ACTION_APPROVE; } return parent::getActionforACL(); }
/** * Override unknown actions to enable ACL checking * * @see SecureController::getActionforACL() * * @return String */ public function getActionforACL() { $action = strtolower($this->getRequest()->getActionName()); if ($action == "processroles") { return ACTION_CREATE; } if ($action == "processroles" && !isEmptyString($this->_getParam('id'))) { return ACTION_EDIT; } return parent::getActionforACL(); }
/** * Get the name of the resource being accessed * * @return String */ function getActionforACL() { $action = strtolower($this->getRequest()->getActionName()); if ($action == "processvariables" || $action == "processglobalconfig" || $action == "add" || ($action = "leave" || ($action = "leavecreate" || ($action = "leaveindex" || ($action = "shifts" || ($action = "shiftscreate" || ($action = "schedulecreate"))))))) { return ACTION_EDIT; } if ($action == "variables" || $action == "globalconfig" || ($action = "leavelistsearch" || ($action = "shiftslistsearch"))) { return ACTION_LIST; // return ACTION_VIEW; } return parent::getActionforACL(); }
public function init() { parent::init(); Requirements::themedCSS('jquery.mobile-1.2.0.min'); Requirements::themedCSS('jquery-mobile-local'); Requirements::themedCSS('retronaut'); Requirements::javascript($this->ThemeDir() . '/js/jquery-1.8.2.min.js'); Requirements::javascript($this->ThemeDir() . '/js/jquery.flot.js'); Requirements::javascript($this->ThemeDir() . '/js/jquery.flot.resize.js'); Requirements::javascript($this->ThemeDir() . '/js/page.js'); Requirements::javascript($this->ThemeDir() . '/js/jquery.mobile-1.2.0.min.js'); Requirements::javascript($this->ThemeDir() . '/js/taglist.js'); }
public function viewAction() { $session = SessionWrapper::getInstance(); $failurl = $this->view->baseUrl("index/accessdenied"); $acl = getACLInstance(); $id = decode($this->_getParam('id')); if (!isEmptyString($id) && isTimesheetEmployee() && !isCompanyAdmin() && !isAdmin()) { if ($session->getVar('userid') != $id) { $this->_helper->redirector->gotoUrl($failurl); } } parent::viewAction(); }
/** * Override unknown actions to enable ACL checking * * @see SecureController::getActionforACL() * * @return String */ public function getActionforACL() { $action = strtolower($this->getRequest()->getActionName()); if ($action == "checkin" || $action == "checkout" || $action == "processattendance" || $action == "submit" || $action == "request") { if ($action == "checkin" && $this->_getParam('type') == 3) { return ACTION_DELETE; } return ACTION_CREATE; } if ($action == "attendance" || $action == "attendancesearch") { return ACTION_LIST; } if ($action == "approve" || $action == "forapproval") { return ACTION_APPROVE; } return parent::getActionforACL(); }
/** * Override unknown actions to enable ACL checking * * @see SecureController::getActionforACL() * * @return String */ public function getActionforACL() { $action = strtolower($this->getRequest()->getActionName()); return parent::getActionforACL(); }
function __construct() { parent::__construct(); $this->load->model('database'); }
public function init() { parent::init(); $current_timestamp = strtotime('now'); $now_iso = date('Y-m-d H:i:s', $current_timestamp); $this->view->now_iso = $now_iso; //debugMessage('now '.$now_iso.'-'.$current_timestamp); $onehourago_timestamp = strtotime('-1 hour'); $onehourago_iso = date('Y-m-d H:i:s', $onehourago_timestamp); $this->view->onehourago_iso = $onehourago_iso; $this->view->onehourago_timestamp = $onehourago_timestamp; // debugMessage('now '.$onehourago_iso.'-'.$onehourago_timestamp); $sixhourago_timestamp = strtotime('-6 hour'); $sixhourago_iso = date('Y-m-d H:i:s', $sixhourago_timestamp); $this->view->sixhourago_iso = $sixhourago_iso; $this->view->sixhourago_timestamp = $sixhourago_timestamp; $twelvehourago_timestamp = strtotime('-12 hour'); $twelvehourago_iso = date('Y-m-d H:i:s', $twelvehourago_timestamp); $this->view->twelvehourago_timestamp = $twelvehourago_timestamp; $this->view->twelvehourago_iso = $twelvehourago_iso; // debugMessage($logged_today_sql); $today_iso = date('Y-m-d'); $today = changeMySQLDateToPageFormat($today_iso); $this->view->today_iso = $today_iso; //debugMessage('today '.$today_iso); $today_iso_short = date('M j', $current_timestamp); $yestday_iso = date('Y-m-d', strtotime('1 day ago')); $yestday = changeMySQLDateToPageFormat($yestday_iso); $this->view->yestday_iso = $yestday_iso; //debugMessage('yesterday '.$yestday_iso); $yestday_iso_short = date('M j', strtotime($yestday_iso)); $weekday = date("N"); // monday of week $mondaythisweek_iso = date('Y-m-d', strtotime('monday this week')); $mondaythisweek = changeMySQLDateToPageFormat($mondaythisweek_iso); if ($weekday == 1) { $mondaythisweek_iso = $today_iso; $mondaythisweek = $today; } if ($weekday == 7) { $mondaythisweek_iso = date('Y-m-d', strtotime('monday last week')); $mondaythisweek = changeMySQLDateToPageFormat($mondaythisweek_iso); } $this->view->mondaythisweek_iso = $mondaythisweek_iso; //debugMessage('monday this week '.$mondaythisweek_iso); // sunday of week $sundaythisweek_iso = date('Y-m-d', strtotime('sunday this week')); $sundaythisweek = changeMySQLDateToPageFormat($sundaythisweek_iso); if ($weekday == 1) { $sundaythisweek_iso = date('Y-m-d', strtotime('today + 7 days')); $sundaythisweek = changeMySQLDateToPageFormat($sundaythisweek_iso); } if ($weekday == 7) { $sundaythisweek_iso = $today_iso; $sundaythisweek = $today; } $this->view->sundaythisweek_iso = $sundaythisweek_iso; // debugMessage('sunday this week '.$sundaythisweek_iso); // monday last week $mondaylastweek_iso = date('Y-m-d', strtotime('-7 days', strtotime($mondaythisweek_iso))); //debugMessage('monday last week '.$mondaylastweek_iso); $this->view->mondaylastweek_iso = $mondaylastweek_iso; // sunday last week $sundaylastweek_iso = date('Y-m-d', strtotime('-7 days', strtotime($sundaythisweek_iso))); // debugMessage('sunday last week '.$sundaylastweek_iso); $this->view->sundaylastweek_iso = $sundaylastweek_iso; // firstday this month $firstdayofthismonth_iso = getFirstDayOfCurrentMonth(); //debugMessage('1st day this month '.$firstdayofthismonth_iso); $this->view->firstdayofthismonth_iso = $firstdayofthismonth_iso; // lastday this month $lastdayofthismonth_iso = getLastDayOfCurrentMonth(); //debugMessage('last day this month '.$lastdayofthismonth_iso); $this->view->lastdayofthismonth_iso = $lastdayofthismonth_iso; // firstday last month $firstdayoflastmonth_iso = getFirstDayOfMonth(date('m') - 1, date('Y')); //debugMessage('1st day last month '.$firstdayoflastmonth_iso); $this->view->firstdayoflastmonth_iso = $firstdayoflastmonth_iso; // lastday last month $lastdayoflastmonth_iso = getLastDayOfMonth(date('m') - 1, date('Y')); //debugMessage('last day last month '.$lastdayoflastmonth_iso); $this->view->lastdayoflastmonth_iso = $lastdayoflastmonth_iso; // firstday 2 month ago $firstdayof2monthago_iso = getFirstDayOfMonth(date('m') - 2, date('Y')); //debugMessage('1st day 2 month ago '.$firstdayof2monthago_iso); $this->view->firstdayof2monthago_iso = $firstdayof2monthago_iso; // lastday 2 month ago $lastdayof2monthago_iso = getLastDayOfMonth(date('m') - 2, date('Y')); //debugMessage('last day last month '.$lastdayof2monthago_iso); $this->view->lastdayof2monthago_iso = $lastdayof2monthago_iso; // firstday 3 month ago $firstdayof3monthago_iso = getFirstDayOfMonth(date('m') - 3, date('Y')); //debugMessage('1st day 3 month ago '.$firstdayof3monthago_iso); $this->view->firstdayof3monthago_iso = $firstdayof3monthago_iso; // lastday 3 month ago $lastdayof3monthago_iso = getLastDayOfMonth(date('m') - 3, date('Y')); //debugMessage('last day last month '.$lastdayof3monthago_iso); $this->view->lastdayof3monthago_iso = $lastdayof3monthago_iso; // firstday this year $firstdayofyear_iso = getFirstDayOfMonth(1, date('Y')); //debugMessage('1st day this year '.$firstdayofyear_iso); $this->view->firstdayofyear_iso = $firstdayofyear_iso; // lastday this year $lastdayofyear_iso = getLastDayOfMonth(12, date('Y')); //debugMessage('last day this year '.$lastdayofyear_iso); $this->view->lastdayofyear_iso = $lastdayofyear_iso; // first day of month one year ago $startofmonth_oneyearago = getFirstDayOfMonth(date('m', strtotime('1 year ago')), date('Y', strtotime('1 year ago'))); $this->view->startofmonth_oneyearago = $startofmonth_oneyearago; $firstsystemday_iso = '2013-01-01'; $this->view->firstsystemday_iso = $firstsystemday_iso; }
function createAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); $session = SessionWrapper::getInstance(); $this->_translate = Zend_Registry::get("translate"); $config = Zend_Registry::get("config"); $formvalues = $this->_getAllParams(); // debugMessage($formvalues); exit(); $isuserdoc = false; $iscompanydoc = false; if (!isArrayKeyAnEmptyString('userid', $formvalues)) { $isuserdoc = true; $folderid = $formvalues['userid']; } else { $iscompanydoc = true; $folderid = getCompanyID(); } if (isset($_FILES["FileInput"]) && $_FILES["FileInput"]["error"] == UPLOAD_ERR_OK && !array_key_exists('submit', $formvalues)) { if (!isset($_FILES['FileInput']['name'])) { $error = "<span class='alert alert-danger blocked'>Error: Please select a File to Upload.</span>"; $result = array('msg' => $error, 'result' => ''); echo $error; exit; } // if uploading a user document if ($isuserdoc) { // base path for user documents $destination_path = BASE_PATH . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . "users" . DIRECTORY_SEPARATOR . "user_"; // determine if user has destination avatar folder. Else user is editing there picture if (!is_dir($destination_path . $folderid)) { // no folder exits. Create the folder mkdir($destination_path . $folderid, 0775); } } // if uploading a company document if ($iscompanydoc) { // base path for user documents $destination_path = BASE_PATH . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . "company" . DIRECTORY_SEPARATOR . "comp_"; // determine if user has destination avatar folder. Else user is editing there picture if (!is_dir($destination_path . $folderid)) { // no folder exits. Create the folder mkdir($destination_path . $folderid, 0775); } } $destination_path = $destination_path . $folderid . DIRECTORY_SEPARATOR . "documents"; if (!is_dir($destination_path)) { mkdir($destination_path, 0775); } // create archive folder for each user $archivefolder = $destination_path . DIRECTORY_SEPARATOR . "archive"; if (!is_dir($archivefolder)) { mkdir($archivefolder, 0775); } $oldfile = $_FILES['FileInput']['name']; $File_Name = strtolower($oldfile); $File_Ext = findExtension($File_Name); //get file extention $ext = strtolower($_FILES['FileInput']['type']); // debugMessage($ext); $allowedformatsarray = explode(',', str_replace(' ', '', $config->uploads->docallowedformats)); // debugMessage($allowedformatsarray);exit(); $uploadedext = findExtension($File_Name); $currenttime = time(); //Random number to be added to name. $currenttime_file = $currenttime . '.' . $uploadedext; $thefilename = $destination_path . DIRECTORY_SEPARATOR . $currenttime_file; if (isEmptyString($folderid)) { $destination_path = BASE_PATH . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . "temp"; if (!is_dir($destination_path)) { // no folder exits. Create the folder mkdir($destination_path, 0775); } $thefilename = $destination_path . DIRECTORY_SEPARATOR . $currenttime_file; } // check if this is an ajax request if (!isset($_SERVER['HTTP_X_REQUESTED_WITH'])) { $error = "<span class='alert alert-danger blocked'>Error: No Request received.</span>"; $result = array('msg' => $error, 'result' => ''); echo $error; exit; } // debugMessage('size '.$_FILES["FileInput"]["size"]); // validate maximum allowed size $size = $_FILES["FileInput"]["size"]; if ($size > $config->uploads->docmaximumfilesize) { $error = "<span class='alert alert-danger blocked'>Error: Maximum allowed size exceeded.</span>"; $result = array('msg' => $error, 'result' => ''); echo $error; exit; } // validate allowed formats if (!in_array($File_Ext, $allowedformatsarray)) { $error = "<span class='alert alert-danger blocked'>Error: Format '." . $File_Ext . "' not supported. Formats allowed include '" . $config->uploads->docallowedformats . "'</span>"; $result = array('msg' => $error, 'result' => ''); echo $error; exit; } # move the file try { move_uploaded_file($_FILES['FileInput']['tmp_name'], $thefilename); // die('File '.$NewFileName.' Uploaded.'); $result = array('oldfilename' => $oldfile, 'newfilename' => $currenttime_file, 'msg' => 'Successfully uploaded', 'result' => 1, 'filesize' => $size); // debugMessage($result); echo json_encode($result); exit; } catch (Exception $e) { $error = 'Error in uploading File ' . $File_Name . '. ' . $e->getMessage(); $result = array('msg' => $error, 'result' => ''); echo $error; exit; } } if (array_key_exists('submit', $formvalues) || array_key_exists('id', $formvalues)) { $this->_setParam('uploadedbyid', $session->getVar('userid')); $this->_setParam('dateuploaded', DEFAULT_DATETIME); $this->_setParam("action", ACTION_CREATE); if (!isArrayKeyAnEmptyString('id', $formvalues)) { $this->_setParam("action", ACTION_EDIT); } // debugMessage($formvalues); exit(); parent::createAction(); } }
public function init() { parent::init(); }
public function __construct() { parent::__construct(); $this->bouncer = "Secure"; $this->renderer = "Page"; }
/** * Pre-processing for all actions * * - Disable the layout when displaying printer friendly pages * */ function preDispatch() { parent::preDispatch(); // disable rendering of the layout so that we can just echo the AJAX output if (!isEmptyString($this->_getParam(EXPORT_TO_EXCEL))) { // disable rendering of the view and layout so that we can just echo the AJAX output $this->_helper->layout->disableLayout(); // required for IE, otherwise Content-disposition is ignored if (ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); } $response = $this->getResponse(); # This line will stream the file to the user rather than spray it across the screen $response->setHeader("Content-type", "application/vnd.ms-excel"); # replace excelfile.xls with whatever you want the filename to default to $response->setHeader("Content-Disposition", "attachment;filename=" . time() . rand(1, 10) . ".xls"); $response->setHeader("Expires", 0); $response->setHeader("Cache-Control", "private"); session_cache_limiter("public"); } }