本文整理汇总了PHP中isArrayKeyAnEmptyString函数的典型用法代码示例。如果您正苦于以下问题:PHP isArrayKeyAnEmptyString函数的具体用法?PHP isArrayKeyAnEmptyString怎么用?PHP isArrayKeyAnEmptyString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isArrayKeyAnEmptyString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: processPost
function processPost($formvalues)
{
// trim spaces from the name field
if (isArrayKeyAnEmptyString('companyid', $formvalues)) {
$formvalues['companyid'] = getCompanyID();
}
if (isArrayKeyAnEmptyString('defaultquantity', $formvalues)) {
unset($formvalues['defaultquantity']);
}
if (isArrayKeyAnEmptyString('quantitytype', $formvalues)) {
unset($formvalues['quantitytype']);
}
if (isArrayKeyAnEmptyString('deductfromallowance', $formvalues)) {
unset($formvalues['deductfromallowance']);
}
if (isArrayKeyAnEmptyString('paid', $formvalues)) {
unset($formvalues['paid']);
}
if (isArrayKeyAnEmptyString('bookable', $formvalues)) {
unset($formvalues['bookable']);
}
if (isArrayKeyAnEmptyString('authorised', $formvalues)) {
unset($formvalues['authorised']);
}
if (isArrayKeyAnEmptyString('viewoncalendar', $formvalues)) {
unset($formvalues['viewoncalendar']);
}
// debugMessage($formvalues); exit();
parent::processPost($formvalues);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:30,代码来源:LeaveType.php
示例2: processPost
function processPost($formvalues)
{
// trim spaces from the name field
if (isArrayKeyAnEmptyString('companyid', $formvalues)) {
$formvalues['companyid'] = getCompanyID();
}
if (isArrayKeyAnEmptyString('hours', $formvalues)) {
unset($formvalues['hours']);
}
if (isArrayKeyAnEmptyString('starttime', $formvalues)) {
unset($formvalues['starttime']);
} else {
$formvalues['starttime'] = date("H:i:s", strtotime($formvalues['starttime']));
}
if (isArrayKeyAnEmptyString('endtime', $formvalues)) {
unset($formvalues['endtime']);
} else {
$formvalues['endtime'] = date("H:i:s", strtotime($formvalues['endtime']));
}
if (isArrayKeyAnEmptyString('overduestarttime', $formvalues)) {
unset($formvalues['overduestarttime']);
} else {
$formvalues['overduestarttime'] = date("H:i:s", strtotime($formvalues['overduestarttime']));
}
if (isArrayKeyAnEmptyString('breakhrs', $formvalues)) {
unset($formvalues['breakhrs']);
}
// debugMessage($formvalues); exit();
parent::processPost($formvalues);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:30,代码来源:Shift.php
示例3: processPost
function processPost($formvalues)
{
$session = SessionWrapper::getInstance();
// trim spaces from the name field
if (isArrayKeyAnEmptyString('parentid', $formvalues)) {
unset($formvalues['parentid']);
}
if (isArrayKeyAnEmptyString('sectorid', $formvalues)) {
unset($formvalues['sectorid']);
if (!isEmptyString($formvalues['parentid'])) {
$category = new Category();
$category->populate($formvalues['parentid']);
$formvalues['sectorid'] = $category->getSectorID();
}
}
if (isArrayKeyAnEmptyString('level', $formvalues)) {
unset($formvalues['level']);
}
if (isArrayKeyAnEmptyString('type', $formvalues)) {
unset($formvalues['type']);
}
if (isArrayKeyAnEmptyString('status', $formvalues)) {
unset($formvalues['status']);
}
if (isArrayKeyAnEmptyString('uneditable', $formvalues)) {
unset($formvalues['uneditable']);
}
if (isArrayKeyAnEmptyString('sortorder', $formvalues)) {
if (!isEmptyString($formvalues['parentid']) && !isEmptyString($formvalues['sectorid'])) {
$formvalues['sortorder'] = $this->getNextSortOrder($formvalues['sectorid'], $formvalues['parentid']);
}
}
// debugMessage($formvalues); exit();
parent::processPost($formvalues);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:35,代码来源:Category.php
示例4: updatestatusAction
function updatestatusAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
$formvalues = $this->_getAllParams();
debugMessage($formvalues);
$session = SessionWrapper::getInstance();
$this->_translate = Zend_Registry::get("translate");
$formvalues['id'] = $id = $formvalues['id'];
$formvalues['dateapproved'] = date("Y-m-d H:i:s", strtotime('now'));
$formvalues['approvedbyid'] = $session->getVar('userid');
// debugMessage($formvalues);
$leave = new Leave();
$leave->populate($id);
$leave->setStatus($formvalues['status']);
$leave->setDateApproved(DEFAULT_DATETIME);
$leave->setApprovedByID($session->getVar('userid'));
if (!isArrayKeyAnEmptyString('reason', $formvalues)) {
$leave->setReason("<br/>Rejected with remarks: " . $formvalues['reason']);
}
try {
$leave->save();
$leave->afterApprove($formvalues['status']);
$session->setVar(SUCCESS_MESSAGE, $this->_translate->translate($formvalues[SUCCESS_MESSAGE]));
} catch (Exception $e) {
// debugMessage('error '.$e->getMessage());
$session->setVar(ERROR_MESSAGE, $e->getMessage());
}
// exit();
$this->_helper->redirector->gotoUrl(decode($formvalues[URL_SUCCESS]));
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:31,代码来源:LeaveController.php
示例5: processPost
function processPost($formvalues)
{
// trim spaces from the name field
if (isArrayKeyAnEmptyString('type', $formvalues)) {
unset($formvalues['type']);
}
if (isArrayKeyAnEmptyString('benefitid', $formvalues)) {
unset($formvalues['benefitid']);
}
if (isArrayKeyAnEmptyString('amount', $formvalues)) {
unset($formvalues['amount']);
}
if (isArrayKeyAnEmptyString('benefitfrequency', $formvalues)) {
unset($formvalues['benefitfrequency']);
}
if (isArrayKeyAnEmptyString('leavetypeid', $formvalues)) {
unset($formvalues['leavetypeid']);
}
if (isArrayKeyAnEmptyString('accrualtype', $formvalues)) {
unset($formvalues['accrualtype']);
}
if (isArrayKeyAnEmptyString('accrualfrequency', $formvalues)) {
unset($formvalues['accrualfrequency']);
}
if (isArrayKeyAnEmptyString('accrualvalue', $formvalues)) {
unset($formvalues['accrualvalue']);
}
// debugMessage($formvalues); exit();
parent::processPost($formvalues);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:30,代码来源:UserBenefit.php
示例6: eventsAction
function eventsAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
$config = Zend_Registry::get("config");
$session = SessionWrapper::getInstance();
$formvalues = $this->_getAllParams();
$acl = getACLInstance();
$user = new UserAccount();
// $user->populate($formvalues['id']);
$events = getLeaveRequests("", getYearStart(), getYearEnd());
// debugMessage($events);
$jsondata = array();
$i = 0;
if (count($events) > 0) {
// $jsondata = $events;
$leaveoptions = getHoursDaysDropdown();
foreach ($events as $key => $value) {
$jsondata[$key]['id'] = $value['id'];
$unit = '';
if (!isArrayKeyAnEmptyString($value['durationtype'], $leaveoptions)) {
$unit = ' on Leave';
}
$jsondata[$key]['title'] = $value['user'] . $unit;
$jsondata[$key]['start'] = $value['startdate'];
$jsondata[$key]['end'] = $value['enddate'];
if (isTimesheetEmployee() && $value['userid'] == $session->getVar('userid') || $acl->checkPermission('Leave', ACTION_APPROVE)) {
// $jsondata[$key]['url'] = $this->view->serverUrl($this->view->baseUrl('leave/view/id/'.encode($value['id'])));
}
}
}
// debugMessage($jsondata);
echo json_encode($jsondata);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:34,代码来源:CalendarController.php
示例7: processPost
function processPost($formvalues)
{
$session = SessionWrapper::getInstance();
// trim spaces from the name field
if (isArrayKeyAnEmptyString('create', $formvalues)) {
$formvalues['create'] = 0;
}
if (isArrayKeyAnEmptyString('edit', $formvalues)) {
$formvalues['edit'] = 0;
}
if (isArrayKeyAnEmptyString('view', $formvalues)) {
$formvalues['view'] = 0;
}
if (isArrayKeyAnEmptyString('list', $formvalues)) {
$formvalues['list'] = 0;
}
if (isArrayKeyAnEmptyString('delete', $formvalues)) {
$formvalues['delete'] = 0;
}
if (isArrayKeyAnEmptyString('export', $formvalues)) {
$formvalues['export'] = 0;
}
if (isArrayKeyAnEmptyString('approve', $formvalues)) {
$formvalues['approve'] = 0;
}
if (isArrayKeyAnEmptyString('flag', $formvalues)) {
$formvalues['flag'] = 0;
}
// debugMessage($formvalues); exit();
parent::processPost($formvalues);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:31,代码来源:AclPermission.php
示例8: processPost
function processPost($formvalues)
{
# force setting of default none string column values. enum, int and date
if (isArrayKeyAnEmptyString('isread', $formvalues)) {
$formvalues['isread'] = '0';
}
parent::processPost($formvalues);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:8,代码来源:MessageRecipient.php
示例9: processPost
/**
* Clean up the post array before populating the values of the object:
* - Remove the blank values for the executedby field which will cause a foreign key error
*
* @param Array $post_array The post array
*
* @see BaseRecord::processPost
*/
public function processPost($formvalues)
{
// remove the executedby field if it is empty
if (isArrayKeyAnEmptyString('isupdate', $formvalues)) {
unset($formvalues['isupdate']);
}
if (isArrayKeyAnEmptyString('userid', $formvalues)) {
unset($formvalues['userid']);
}
parent::processPost($formvalues);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:19,代码来源:AuditTrail.php
示例10: processPost
function processPost($formvalues)
{
// check if the active is not specified and set to default value
if (isArrayKeyAnEmptyString('active', $formvalues)) {
unset($formvalues['active']);
}
if (isArrayKeyAnEmptyString('editable', $formvalues)) {
unset($formvalues['editable']);
}
# debugMessage($formvalues);
parent::processPost($formvalues);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:12,代码来源:AppConfig.php
示例11: processPost
function processPost($formvalues)
{
// trim spaces from the name field
if (isArrayKeyAnEmptyString('companyid', $formvalues)) {
unset($formvalues['companyid']);
}
if (isArrayKeyAnEmptyString('status', $formvalues)) {
unset($formvalues['status']);
}
// debugMessage($formvalues); exit();
parent::processPost($formvalues);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:12,代码来源:Payroll.php
示例12: processPost
/**
* Pre process model data
*/
function processPost($formvalues)
{
# force setting of default none string column values. enum, int and date
if (isArrayKeyAnEmptyString('parentid', $formvalues)) {
unset($formvalues['parentid']);
}
if (isArrayKeyAnEmptyString('type', $formvalues)) {
unset($formvalues['type']);
}
if (isArrayKeyAnEmptyString('refid', $formvalues)) {
unset($formvalues['refid']);
}
parent::processPost($formvalues);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:17,代码来源:Message.php
示例13: processPost
function processPost($formvalues)
{
// trim spaces from the name field
if (isArrayKeyAnEmptyString('companyid', $formvalues)) {
$formvalues['companyid'] = 1;
}
if (isArrayKeyAnEmptyString('defaultamount', $formvalues)) {
unset($formvalues['defaultamount']);
}
if (isArrayKeyAnEmptyString('amounttype', $formvalues)) {
unset($formvalues['amounttype']);
}
// debugMessage($formvalues); exit();
parent::processPost($formvalues);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:15,代码来源:BenefitType.php
示例14: processPost
function processPost($formvalues)
{
// trim spaces from the name field
if (isArrayKeyAnEmptyString('headid', $formvalues)) {
if (isArrayKeyAnEmptyString('headid_old', $formvalues)) {
unset($formvalues['headid']);
} else {
$formvalues['headid'] = NULL;
}
}
if (isArrayKeyAnEmptyString('companyid', $formvalues)) {
$formvalues['companyid'] = DEFAULT_COMPANYID;
}
// debugMessage($formvalues); exit();
parent::processPost($formvalues);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:16,代码来源:Department.php
示例15: processPost
/**
* Preprocess model data
*/
function processPost($formvalues)
{
// set default values for integers, dates, decimals
if (isArrayKeyAnEmptyString('userid', $formvalues)) {
unset($formvalues['userid']);
}
if (isArrayKeyAnEmptyString('personid', $formvalues)) {
unset($formvalues['personid']);
}
if (isArrayKeyAnEmptyString('namesection', $formvalues)) {
unset($formvalues['namesection']);
}
if (isArrayKeyAnEmptyString('familysection', $formvalues)) {
unset($formvalues['familysection']);
}
if (isArrayKeyAnEmptyString('clansection', $formvalues)) {
unset($formvalues['clansection']);
}
if (isArrayKeyAnEmptyString('personalsection', $formvalues)) {
unset($formvalues['personalsection']);
}
if (isArrayKeyAnEmptyString('emailaddresssection', $formvalues)) {
unset($formvalues['emailaddresssection']);
}
if (isArrayKeyAnEmptyString('phonesection', $formvalues)) {
unset($formvalues['phonesection']);
}
if (isArrayKeyAnEmptyString('physicaladdresssection', $formvalues)) {
unset($formvalues['physicaladdresssection']);
}
if (isArrayKeyAnEmptyString('webaddresssection', $formvalues)) {
unset($formvalues['webaddresssection']);
}
if (isArrayKeyAnEmptyString('birthsection', $formvalues)) {
unset($formvalues['birthsection']);
}
if (isArrayKeyAnEmptyString('birthrule', $formvalues)) {
unset($formvalues['birthrule']);
}
if (isArrayKeyAnEmptyString('defaultprivacy', $formvalues)) {
unset($formvalues['defaultprivacy']);
}
parent::processPost($formvalues);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:47,代码来源:Privacy.php
示例16: processPost
/**
* Populate the attributes of the object with the data. Also add the auditing data, createdby and lastupdatedby to
* the relationships if not specified
*
* @param Array $post_array The array of data values to populate the object attributes
* @return boolean true if the object validates after populaton, or false if there are any validation errors
*/
function processPost($post_array)
{
// $post_array = trimArray($post_array);
# format the date fields
foreach ($this->datefields as $fieldname) {
if (isArrayKeyAnEmptyString($fieldname, $post_array)) {
// remove the empty string from the array otherwise the date will be set to January 1, 1970
unset($post_array[$fieldname]);
} else {
$post_array[$fieldname] = changeDateFromPageToMySQLFormat($post_array[$fieldname]);
// TODO: SM - 09/17/10 - Cleanup this funny hack for dates,
// I am not sure why new values for the dates are not picked up,
// make the dates an empty string so that they can be updated
$this->_set($fieldname, "");
}
}
$relations = $this->getTable()->getRelations();
# loop through each relation and add auditing fields
foreach ($relations as $alias => $arelation) {
if (!isArrayKeyAnEmptyString($alias, $post_array)) {
foreach ($post_array[$alias] as $key => $value) {
# force the loading of only the hasOne relationships to conserve memory
if ($arelation['type'] == 0) {
$this->{$alias};
}
if (!isArrayKeyAnEmptyString('createdby', $post_array)) {
// add createdby to each relation
if ($arelation['type'] == 0) {
// hasOne so only one item in the relation
$post_array[$alias]['createdby'] = $post_array['createdby'];
} else {
// hasMany, use a key to populate each item in the relation
$post_array[$alias][$key]['createdby'] = $post_array['createdby'];
}
}
// check if the createdby field is still empty then use the lastupdatedby field since the relation is new
if (isArrayKeyAnEmptyString('createdby', $post_array[$alias])) {
if (!isArrayKeyAnEmptyString('lastupdatedby', $post_array)) {
if ($arelation['type'] == 0) {
// hasOne so only one item in the relation
$post_array[$alias]['createdby'] = $post_array['lastupdatedby'];
} else {
// hasMany, use a key to populate each item in the relation
$post_array[$alias][$key]['createdby'] = $post_array['lastupdatedby'];
}
}
}
if (!isArrayKeyAnEmptyString('lastupdatedby', $post_array)) {
// add lastupdatedby to each data item
if ($arelation['type'] == 0) {
// hasOne so only one item in the relation
$post_array[$alias]['lastupdatedby'] = $post_array['lastupdatedby'];
} else {
// hasMany, use a key to populate each item in the relation
$post_array[$alias][$key]['lastupdatedby'] = $post_array['lastupdatedby'];
}
}
// remove any empty id columns
if ($arelation['type'] == 0) {
// unset any empty id columns which have been sent - hasOne
if (isArrayKeyAnEmptyString('id', $post_array[$alias])) {
// remove the empty id field
unset($post_array[$alias]['id']);
}
} else {
// unset any empty id columns which have been sent - hasMany
if (isArrayKeyAnEmptyString('id', $post_array[$alias][$key])) {
// remove the empty id field
unset($post_array[$alias][$key]['id']);
}
}
}
}
// end check whether alias exists in the data for population to eliminate PHP warnings
}
# remove the ID field if it is empty
if (isArrayKeyAnEmptyString('id', $post_array)) {
unset($post_array['id']);
}
$this->synchronizeWithArray($post_array, true);
return $this->isValid(true);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:89,代码来源:BaseRecord.php
示例17: createAction
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 {
//.........这里部分代码省略.........
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:101,代码来源:DocumentController.php
示例18: processPost
/**
* Clean out the data received from the screen by:
* - remove empty/blank groupid - the groupid is not required and therefore is an empty value is maintained will cause an out of range exception
*
* @param Array $post_array
*/
function processPost($post_array)
{
$session = SessionWrapper::getInstance();
// check if the groupid is blank then remove it
$permissions = $this->getPermissions();
$permissions_array = $permissions->toArray();
if (array_key_exists('permissions', $post_array)) {
if (is_array($post_array['permissions'])) {
$data = array();
foreach ($post_array['permissions'] as $key => $value) {
$data[$key] = $value;
if (array_key_exists('groupid', $value)) {
if (isEmptyString($value['groupid'])) {
unset($post_array['permissions'][$key]['groupid']);
}
}
if (isArrayKeyAnEmptyString('create', $value)) {
$post_array['permissions'][$key]['create'] = 0;
} else {
$post_array['permissions'][$key]['create'] = trim(intval($value['create']));
}
if (isArrayKeyAnEmptyString('edit', $value)) {
$post_array['permissions'][$key]['edit'] = 0;
} else {
$post_array['permissions'][$key]['edit'] = trim(intval($value['edit']));
}
if (isArrayKeyAnEmptyString('view', $value)) {
$post_array['permissions'][$key]['view'] = 0;
} else {
$post_array['permissions'][$key]['view'] = trim(intval($value['view']));
}
if (isArrayKeyAnEmptyString('list', $value)) {
$post_array['permissions'][$key]['list'] = 0;
} else {
$post_array['permissions'][$key]['list'] = trim(intval($value['list']));
}
if (isArrayKeyAnEmptyString('delete', $value)) {
$post_array['permissions'][$key]['delete'] = 0;
} else {
$post_array['permissions'][$key]['delete'] = trim(intval($value['delete']));
}
if (isArrayKeyAnEmptyString('approve', $value)) {
$post_array['permissions'][$key]['approve'] = 0;
} else {
$post_array['permissions'][$key]['approve'] = trim(intval($value['approve']));
}
if (isArrayKeyAnEmptyString('export', $value)) {
$post_array['permissions'][$key]['export'] = 0;
} else {
$post_array['permissions'][$key]['export'] = trim(intval($value['export']));
}
if (isArrayKeyAnEmptyString('id', $value)) {
unset($post_array['permissions'][$key]['id']);
$post_array['permissions'][$key]['createdby'] = $session->getVar('userid');
$post_array['permissions'][$key]['datecreated'] = getCurrentMysqlTimestamp();
}
if (!isArrayKeyAnEmptyString('id', $value)) {
$post_array['permissions'][$key]['lastupdatedby'] = $session->getVar('userid');
$post_array['permissions'][$key]['lastupdatedate'] = getCurrentMysqlTimestamp();
$data = $post_array['permissions'][$key];
unset($post_array['permissions'][$key]);
$newkey = array_search_key_by_id($permissions_array, $value['id']);
// debugMessage($data);
$post_array['permissions'][$newkey] = $data;
}
}
// end loop through permissions to unset empty groupids
}
}
// now process the data
// debugMessage($post_array['permissions']); // exit();
parent::processPost($post_array);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:79,代码来源:AclGroup.php
示例19: schedulecreateAction
function schedulecreateAction()
{
$session = SessionWrapper::getInstance();
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
// parent::createAction();
$formvalues = $this->_getAllParams();
// debugMessage($formvalues); exit();
$formvalues['id'] = $id = decode($formvalues['id']);
$status = $formvalues['status'];
$old_shift = $formvalues['shift_old'];
$isactive = false;
$shift = new ShiftSchedule();
if (!isArrayKeyAnEmptyString('id', $formvalues)) {
$shift->populate($id);
$isactive = $shift->isActive();
} else {
$formvalues['addedbyid'] = $session->getVar('userid');
$formvalues['dateadded'] = DEFAULT_DATETIME;
}
$shift->processPost($formvalues);
if ($shift->hasError()) {
debugMessage('errors are ' . $shift->getErrorStackAsString());
exit;
$session->setVar(ERROR_MESSAGE, $shift->getErrorStackAsString());
$this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
exit;
}
// exit;
try {
$updateshift = false;
if ($status == 1) {
if ($old_shift != $shift->getSessionID()) {
$shift->getUser()->setShift($shift->getSessionID());
$updateshift = true;
}
} else {
if (!isEmptyString($old_shift) && $isactive) {
$shift->getUser()->setShift(NULL);
$updateshift = true;
}
}
// debugMessage($shift->toArray()); exit;
$shift->save();
# update any previous shifts that could still be active when setting a new active session
if ($status == 1) {
$updateableshifts = $shift->getCurrentActiveShiftsForUser($shift->getUserID());
// debugMessage($updateableshifts->toArray());
if ($updateableshifts->count() > 0) {
foreach ($updateableshifts as $ashift) {
$ashift->setStatus(0);
$ashift->save();
}
}
}
$session->setVar(SUCCESS_MESSAGE, $this->_getParam('successmessage'));
$this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_SUCCESS)));
} catch (Exception $e) {
$session->setVar(ERROR_MESSAGE, $e->getMessage());
//debugMessage('save error '.$e->getMessage());
$this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
}
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:63,代码来源:ConfigController.php
示例20: checkloginAction
function checkloginAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
$session = SessionWrapper::getInstance();
$formvalues = $this->_getAllParams();
// debugMessage($formvalues);
# check that an email has been provided
if (isEmptyString(trim($this->_getParam("email")))) {
$session->setVar(ERROR_MESSAGE, $this->_translate->translate("profile_email_error"));
$session->setVar(FORM_VALUES, $this->_getAllParams());
// return to the home page
$this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
}
if (isEmptyString(trim($this->_getParam("password")))) {
$session->setVar(ERROR_MESSAGE, $this->_translate->translate("profile_password_error"));
$session->setVar(FORM_VALUES, $this->_getAllParams());
// return to the home page
$this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
}
# check which field user is using to login. default is username
$credcolumn = "username";
$login = (string) trim($this->_getParam("email"));
// $password = encode(sha1(trim($this->_getParam("password"))));
# check if credcolumn is emai
$validator = new Zend_Validate_EmailAddress();
if ($validator->isValid($login)) {
$usertable = new UserAccount();
if ($usertable->findByEmail($login)) {
$credcolumn = 'email';
}
}
if (stringContains('!@#', $login)) {
$credcolumn = 'trx';
$loginarray = explode('.', $login);
// debugMessage($loginarray);
$id = $loginarray[0];
}
// debugMessage($credcolumn); exit;
$browser = new Browser();
$audit_values = $browser_session = array("browserdetails" => $browser->getBrowserDetailsForAudit(), "browser" => $browser->getBrowser(), "version" => $browser->getVersion(), "useragent" => $browser->getUserAgent(), "os" => $browser->getPlatform(), "ismobile" => $browser->isMobile() ? '1' : 0, "ipaddress" => $browser->getIPAddress());
// debugMessage($audit_values);
if ($credcolumn == 'email' || $credcolumn == 'username') {
$authAdapter = new Zend_Auth_Adapter_DbTable(Zend_Registry::get("dbAdapter"));
// define the table, fields and additional rules to use for authentication
$authAdapter->setTableName('useraccount');
$authAdapter->setIdentityColumn($credcolumn);
$authAdapter->setCredentialColumn('password');
$authAdapter->setCredentialTreatment("sha1(?) AND status = '1' ");
// set the credentials from the login form
$authAdapter->setIdentity($login);
$authAdapter->setCredential($this->_getParam("password"));
// new class to audit the type of Browser and OS that the visitor is using
if (!$authAdapter->authenticate()->isValid()) {
// debugMessage('invalid'); exit;
// add failed login to audit trail
$audit_values['module'] = 1;
$audit_values['usecase'] = '1.1';
$audit_values['transactiontype'] = USER_LOGIN;
$audit_values['status'] = "N";
$audit_values['transactiondetails'] = "Login for user with id '" . $this->_getParam("email") . "' failed. Invalid username or password";
// exit();
$this->notify(new sfEvent($this, USER_LOGIN, $audit_values));
// return to the home page
if (!isArrayKeyAnEmptyString(URL_FAILURE, $formvalues)) {
$session->setVar(ERROR_MESSAGE, "Invalid Email or Username or Password. <br />Please Try Again.");
$this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
} else {
$session->setVar(ERROR_MESSAGE, "Invalid Email or Username or Password. <br />Please Try Again.");
$this->_helper->redirector->gotoSimple('login', "user");
}
return false;
}
// user is logged in sucessfully so add information to the session
$user = $authAdapter->getResultRowObject();
$useraccount = new UserAccount();
$useraccount->populate($user->id);
}
// exit;
# trx login
if ($credcolumn == 'trx') {
$useraccount = new UserAccount();
$useraccount->populate($id);
// debugMessage($result); exit();
if (isEmptyString($useraccount->getID())) {
// return to the home page
if (!isArrayKeyAnEmptyString(URL_FAILURE, $formvalues)) {
$session->setVar(ERROR_MESSAGE, "Invalid Email or Username or Password. <br />Please Try Again.");
$this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
} else {
$session->setVar(ERROR_MESSAGE, "Invalid Email or Username or Password. <br />Please Try Again.");
$this->_helper->redirector->gotoSimple('login', "user");
}
return false;
}
}
// debugMessage($useraccount->toArray()); exit();
$session->setVar("userid", $useraccount->getID());
$session->setVar("username", $useraccount->getUserName());
$session->setVar("type", $useraccount->getType());
//.........这里部分代码省略.........
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:101,代码来源:UserController.php
|
请发表评论