当前位置: 首页>>代码示例>>PHP>>正文


PHP UserAccount::populate方法代码示例

本文整理汇总了PHP中UserAccount::populate方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAccount::populate方法的具体用法?PHP UserAccount::populate怎么用?PHP UserAccount::populate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserAccount的用法示例。


在下文中一共展示了UserAccount::populate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: indexAction

    function indexAction()
    {
        $session = SessionWrapper::getInstance();
        $this->_helper->layout->disableLayout();
        $this->_helper->viewRenderer->setNoRender(TRUE);
        $conn = Doctrine_Manager::connection();
        $formvalues = $this->_getAllParams();
        $userid = $session->getVar('userid');
        $companyid = getCompanyID();
        $acl = getACLInstance();
        $company_query = "";
        $company_query = " u.companyid = '" . $companyid . "' AND ";
        $q = $formvalues['searchword'];
        $html = '';
        $hasdata = false;
        // )
        # search users if loggedin user has access
        if ($acl->checkPermission('User Account', ACTION_LIST)) {
            $query = "SELECT u.id FROM useraccount as u \n\t\t\t\tWHERE " . $company_query . "\n\t\t\t   (u.firstname like '%" . $q . "%' or \n\t\t\t\tu.lastname like '%" . $q . "%' or \n\t\t\t\tu.othername like '%" . $q . "%' or \n\t\t\t\tu.displayname like '%" . $q . "%' or \n\t\t\t\tu.email like '%" . $q . "%' or \n\t\t\t\tu.phone like '%" . $q . "%' or \n\t\t\t\tu.username like '%" . $q . "%') \n\t\t\t\tGROUP BY u.id\n\t\t\t\torder by u.displayname asc LIMIT 5 ";
            // debugMessage($query);
            $result = $conn->fetchAll($query);
            $count_results = count($result);
            // debugMessage($result);
            if ($count_results > 0) {
                $hasdata = true;
                $html .= '<div class="separator"><span>Employees</span>
					<div class="allresults"><a href="' . $this->view->baseUrl('profile/list/searchterm/' . $q) . '" class="blockanchor">...see more results</a></div>
				</div><ul>';
                foreach ($result as $row) {
                    $user = new UserAccount();
                    $user->populate($row['id']);
                    $b_q = '<b>' . $q . '</b>';
                    $name = $user->getDisplayName();
                    $name = str_ireplace($q, $b_q, $name);
                    $position = getDatavariables('EMPLOYEE_POSITIONS', $user->getPosition(), true);
                    $phone = $user->getPhone();
                    $phone = str_ireplace($q, $b_q, $phone);
                    $email = $user->getEmail();
                    $email = str_ireplace($q, $b_q, $email);
                    $media = $user->getMediumPicturePath();
                    $viewurl = $this->view->baseUrl('profile/view/id/' . encode($row['id']));
                    $html .= '
					<li style="height:auto; min-height:90px;" class="display_box" align="left" url="' . $viewurl . '" theid="' . $row['id'] . '">
						<a href="' . $viewurl . '" style="color:#666; text-decoration:none;">
							<img class="imagecontainer" src="' . $media . '" style="width:78px; height:auto; float:left; margin-right:6px;" />
							<div style="margin-left: 70px;">
								<span class="name blocked">' . $name . '</span>
								<span class="name blocked">' . $position . '</span>
								<span class="blocked" style="margin-top:5px;">Email: ' . $email . '</span>
								<span class="blocked">Phone: ' . $phone . '</span>
								
							</div>
						</a>
					</li>';
                }
            }
        }
        # add navigation to searchable parameters
        $result = array('id' => 1, 'users' => '');
        # check no data is available for all areas and return no results message
        if (!$hasdata) {
            $html .= '
				<li class="display_box" align="center" style="height:30px;">
					<span style="width:100%; display:block; text-align:center;">No results for <b>' . $q . '</b></span>
				</li>';
        }
        $html .= '</ul>';
        echo $html;
    }
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:69,代码来源:SearchController.php

示例2: processnotificationAction

 function processnotificationAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $session = SessionWrapper::getInstance();
     $config = Zend_Registry::get("config");
     $message_collection = new Doctrine_Collection(Doctrine_Core::getTable("Message"));
     $formvalues = $this->_getAllParams();
     // debugMessage($formvalues); exit;
     $recipients_array = array();
     $messagedata = array();
     $users = array();
     $execresult = array('result' => '', 'msg' => '');
     $type = $formvalues['type'];
     if ($type == 1) {
         $ismail = true;
         $issms = false;
         $msgtype = "mail";
     }
     if ($type == 2) {
         $issms = true;
         $ismail = false;
         $msgtype = "sms";
     }
     $custom_query = "";
     if ($formvalues['selecttype'] == 2) {
         if (!isArrayKeyAnEmptyString('userids', $formvalues)) {
             $users = $formvalues['userids'];
         }
     }
     if ($formvalues['selecttype'] == 4) {
         if ($ismail) {
             $users = getUsersWithEmail();
         }
         if ($issms) {
             $users = getUsersWithPhone();
         }
     }
     //debugMessage($users); exit;
     # if no receipients specified
     if (count($users) == 0) {
         $session->setVar(ERROR_MESSAGE, "Error: No Receipients specified!");
         $this->_helper->redirector->gotoUrl(decode($formvalues[URL_SUCCESS]));
         $execresult = array('result' => 'fail', 'msg' => "Error: No Receipients specified!");
         exit;
     }
     $messages = array();
     $sent = array();
     $phones = array();
     $messages['contents'] = $formvalues['contents'];
     $messages['type'] = $formvalues['type'];
     if (!isArrayKeyAnEmptyString('subject', $formvalues)) {
         $messages['subject'] = $formvalues['subject'];
     } else {
         $messages['subject'] = '';
     }
     $messages['senderid'] = 0;
     if (!isArrayKeyAnEmptyString('senderid', $formvalues)) {
         $messages['senderid'] = $formvalues['senderid'];
     }
     if (!isArrayKeyAnEmptyString('senderemail', $formvalues) && isEmptyString($session->getVar('userid'))) {
         $messages['senderemail'] = $formvalues['senderemail'];
     }
     if (!isArrayKeyAnEmptyString('sendername', $formvalues) && isEmptyString($session->getVar('userid'))) {
         $messages['sendername'] = $formvalues['sendername'];
     }
     # process receipients depending on select type
     foreach ($users as $key => $userid) {
         $user = new UserAccount();
         $id = '';
         if ($formvalues['selecttype'] == 2) {
             $id = $userid;
         }
         if ($formvalues['selecttype'] == 4) {
             $id = $key;
         }
         $user->populate($id);
         // debugMessage($memb->toArray());
         $recipients_array[$id]['recipientid'] = $user->getID();
         $messagedata[$id]['id'] = $user->getID();
         $messagedata[$id]['name'] = $user->getName();
         $messagedata[$id]['email'] = $user->getEmail();
         $messagedata[$id]['phone'] = $user->getPhone();
         $messagedata[$id]['sendemail'] = $user->allowEmailForPrivateMessage() ? 1 : 0;
         if ($ismail) {
             $sent[] = $user->getName() . ' (' . $user->getEmail() . ')';
         }
         if ($issms) {
             $sent[] = $user->getName() . ' (' . $user->getPhone() . ')';
             $phones[] = $user->getPhone();
         }
     }
     $messages['recipients'] = $recipients_array;
     $messages['membertotal'] = count($messagedata);
     $messages['usertotal'] = count($recipients_array);
     $messages['type'] = "notification";
     $messages['subtype'] = "new_" . $msgtype;
     /* debugMessage($sent); 
     		debugMessage($messagedata);  */
     $msg = new Message();
//.........这里部分代码省略.........
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:101,代码来源:NotificationsController.php

示例3: beforeUpdate

 function beforeUpdate()
 {
     $session = SessionWrapper::getInstance();
     # set object data to class variable before update
     $user = new UserAccount();
     $user->populate($this->getID());
     $this->setPreUpdateData($user->toArray());
     // exit;
     return true;
 }
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:10,代码来源:UserAccount.php

示例4: processPost

 function processPost($formvalues)
 {
     $session = SessionWrapper::getInstance();
     // debugMessage($formvalues);
     // trim spaces from the name field
     if (!isArrayKeyAnEmptyString('c_username', $formvalues)) {
         $formvalues['username'] = $formvalues['c_username'];
     }
     if (isArrayKeyAnEmptyString('status', $formvalues)) {
         unset($formvalues['status']);
     }
     if (isArrayKeyAnEmptyString('defaultdepartmentid', $formvalues)) {
         unset($formvalues['defaultdepartmentid']);
     }
     if (isArrayKeyAnEmptyString('defaultuserid', $formvalues)) {
         unset($formvalues['defaultuserid']);
     }
     if (!isArrayKeyAnEmptyString('workingdaysids', $formvalues)) {
         $formvalues['workingdays'] = implode(',', $formvalues['workingdaysids']);
     } else {
         if (!isArrayKeyAnEmptyString('workingdays_old', $formvalues)) {
             if (isArrayKeyAnEmptyString('workingdaysids', $formvalues)) {
                 $formvalues['workingdays'] = NULL;
             }
         } else {
             unset($formvalues['workingdays']);
         }
     }
     if (isArrayKeyAnEmptyString('isinvited', $formvalues)) {
         $formvalues['isinvited'] = NULL;
     }
     if (isArrayKeyAnEmptyString('hasacceptedinvite', $formvalues)) {
         $formvalues['hasacceptedinvite'] = NULL;
     }
     if (isArrayKeyAnEmptyString('dateinvited', $formvalues)) {
         unset($formvalues['dateinvited']);
     }
     if (isArrayKeyAnEmptyString('id', $formvalues)) {
         $formvalues['startdate'] = DEFAULT_DATETIME;
     }
     if (!isArrayKeyAnEmptyString('sendinvite', $formvalues)) {
         if ($formvalues['sendinvite'] == 1) {
             $this->setIsBeingInvited(1);
             $formvalues['isinvited'] = 1;
             $formvalues['invitedbyid'] = $session->getVar('userid');
             $formvalues['dateinvited'] = DEFAULT_DATETIME;
             $formvalues['hasacceptedinvite'] = 0;
         }
     }
     $updateuser = false;
     if (!isArrayKeyAnEmptyString('defaultuserid', $formvalues)) {
         $user = new UserAccount();
         $user->populate($formvalues['defaultuserid']);
         if ($user->isUserInActive()) {
             $updateuser = true;
             $formvalues['defaultuser']['id'] = $formvalues['defaultuserid'];
         }
     } else {
         $updateuser = true;
         $formvalues['defaultuser']['status'] = 0;
         $formvalues['defaultuser']['datecreated'] = date('Y-m-d', time());
         $formvalues['defaultuser']['createdby'] = $session->getVar('userid');
         $formvalues['defaultuser']['usergroups'][0]["groupid"] = 3;
         $formvalues['defaultuser']['type'] = 3;
     }
     if ($updateuser) {
         $names = explode(' ', $this->getContactPerson());
         debugMessage($names);
         $formvalues['defaultuser']['firstname'] = $names[0];
         if (!isArrayKeyAnEmptyString(1, $names)) {
             $formvalues['defaultuser']['lastname'] = $names[1];
         } else {
             $formvalues['defaultuser']['lastname'] = '.';
         }
         if (!isArrayKeyAnEmptyString(2, $names)) {
             $formvalues['defaultuser']['othername'] = $names[2];
         }
         $formvalues['defaultuser']['email'] = $this->getEmail();
         if ($this->getIsBeinginvited() == '1') {
             $formvalues['defaultuser']['hasacceptedinvite'] = 0;
             $formvalues['defaultuser']['dateinvited'] = date('Y-m-d', time());
             $formvalues['defaultuser']['invitedbyid'] = $session->getVar('userid');
             $formvalues['defaultuser']['isinvited'] = 1;
         }
     }
     if (isArrayKeyAnEmptyString('openinghour', $formvalues)) {
         unset($formvalues['openinghour']);
     } else {
         $formvalues['openinghour'] = date("H:i:s", strtotime($formvalues['openinghour']));
     }
     if (isArrayKeyAnEmptyString('closinghour', $formvalues)) {
         unset($formvalues['closinghour']);
     } else {
         $formvalues['closinghour'] = date("H:i:s", strtotime($formvalues['closinghour']));
     }
     if (isArrayKeyAnEmptyString('yearstart', $formvalues)) {
         unset($formvalues['yearstart']);
     } else {
         $formvalues['yearstart'] = date('Y-m-d', strtotime($formvalues['yearstart']));
     }
//.........这里部分代码省略.........
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:101,代码来源:Company.php

示例5: processresetpasswordAction

 public function processresetpasswordAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $session = SessionWrapper::getInstance();
     $formvalues = $this->_getAllParams();
     // debugMessage($formvalues);
     $user = new UserAccount();
     $user->populate(decode($this->_getParam('id')));
     // debugMessage($user->toArray());
     $user->setUsername($formvalues['username']);
     $user->setStatus(1);
     $user->setAgreedToTerms(1);
     if (isEmptyString($user->getActivationDate())) {
         $startdate = date("Y-m-d H:i:s", time());
         $user->setActivationDate($startdate);
     }
     // exit();
     if ($user->resetPassword($this->_getParam('password'))) {
         // save to audit
         $url = $this->view->serverUrl($this->view->baseUrl('profile/view/id/' . encode($user->getID())));
         $usecase = '1.10';
         $module = '1';
         $type = USER_RESET_PASSWORD_CONFIRM;
         $details = "Reset password confirmed for <a href='" . $url . "' class='blockanchor'>" . $user->getName() . "</a>";
         $browser = new Browser();
         $audit_values = $session->getVar('browseraudit');
         $audit_values['module'] = $module;
         $audit_values['usecase'] = $usecase;
         $audit_values['transactiontype'] = $type;
         $audit_values['userid'] = $session->getVar('userid');
         $audit_values['url'] = $url;
         $audit_values['transactiondetails'] = $details;
         $audit_values['status'] = "Y";
         // debugMessage($audit_values);
         $this->notify(new sfEvent($this, $type, $audit_values));
         // send a link to enable the user to recover their password
         $session->setVar(SUCCESS_MESSAGE, "Sucessfully saved. You can now log in using your new Password");
         $this->_helper->redirector->gotoUrl($this->view->baseUrl("user/login"));
     } else {
         // echo "cannot reset password";
         // send an error message that no user with that email was found
         $session = SessionWrapper::getInstance();
         $session->setVar(ERROR_MESSAGE, $user->getErrorStackAsString());
         $session->setVar(FORM_VALUES, $this->_getAllParams());
         $this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
     }
 }
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:48,代码来源:UserController.php

示例6: croppictureAction

 function croppictureAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $session = SessionWrapper::getInstance();
     $formvalues = $this->_getAllParams();
     $user = new UserAccount();
     $user->populate(decode($formvalues['id']));
     $userfolder = $user->getID();
     // debugMessage($formvalues);
     //debugMessage($user->toArray());
     $oldfile = "large_" . $user->getProfilePhoto();
     $base = BASE_PATH . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . "users" . DIRECTORY_SEPARATOR . 'user_' . $userfolder . '' . DIRECTORY_SEPARATOR . 'avatar' . DIRECTORY_SEPARATOR;
     // debugMessage($user->toArray());
     $src = $base . $oldfile;
     $currenttime = time();
     $currenttime_file = $currenttime . '.jpg';
     $newlargefilename = $base . "large_" . $currenttime_file;
     $newmediumfilename = $base . "medium_" . $currenttime_file;
     // exit();
     $image = WideImage::load($src);
     $cropped1 = $image->crop($formvalues['x1'], $formvalues['y1'], $formvalues['w'], $formvalues['h']);
     $resized_1 = $cropped1->resize(300, 300, 'fill');
     $resized_1->saveToFile($newlargefilename);
     //$image2 = WideImage::load($src);
     $cropped2 = $image->crop($formvalues['x1'], $formvalues['y1'], $formvalues['w'], $formvalues['h']);
     $resized_2 = $cropped2->resize(165, 165, 'fill');
     $resized_2->saveToFile($newmediumfilename);
     $user->setProfilePhoto($currenttime_file);
     $user->save();
     // check if UserAccount already has profile picture and archive it
     $ftimestamp = current(explode('.', $user->getProfilePhoto()));
     $allfiles = glob($base . DIRECTORY_SEPARATOR . '*.*');
     $currentfiles = glob($base . DIRECTORY_SEPARATOR . '*' . $ftimestamp . '*.*');
     // debugMessage($currentfiles);
     $deletearray = array();
     foreach ($allfiles as $value) {
         if (!in_array($value, $currentfiles)) {
             $deletearray[] = $value;
         }
     }
     // debugMessage($deletearray);
     if (count($deletearray) > 0) {
         foreach ($deletearray as $afile) {
             $afile_filename = basename($afile);
             rename($afile, $base . DIRECTORY_SEPARATOR . 'archive' . DIRECTORY_SEPARATOR . $afile_filename);
         }
     }
     $session->setVar(SUCCESS_MESSAGE, "Successfully updated profile picture");
     $this->_helper->redirector->gotoUrl($this->view->baseUrl('profile/view/id/' . encode($user->getID())));
     // exit();
 }
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:52,代码来源:ProfileController.php

示例7: checkphoneAction

 function checkphoneAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $formvalues = $this->_getAllParams();
     $phone = trim($formvalues['phone']);
     // debugMessage($formvalues);
     $user = new UserAccount();
     if (!isArrayKeyAnEmptyString('userid', $formvalues)) {
         $user->populate($formvalues['userid']);
     }
     if ($user->phoneExists($phone)) {
         echo '1';
     } else {
         echo '0';
     }
 }
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:17,代码来源:SignupController.php

示例8: processattendanceAction

 function processattendanceAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $session = SessionWrapper::getInstance();
     $config = Zend_Registry::get("config");
     $this->_translate = Zend_Registry::get("translate");
     $validshift = false;
     $formvalues = $this->_getAllParams();
     /* $formvalues = array(
       	 "id" => "",
       			"successmessage" => "Check-In Successfull",
       			"datein" => "Apr 24, 2015",
       			"timein" => "8:40 PM",
       			"inremarks" => "",
       			"status" => "",
       			"userid" => "93"
       	); */
     // debugMessage($formvalues);  //  exit;
     $id = decode($formvalues['id']);
     $formvalues['id'] = $id;
     $timesheet = new Timesheet();
     $user = new UserAccount();
     $user->populate($formvalues['userid']);
     # no shift available at all on profile
     // validate that user is checking into right shift
     if (isEmptyString($id)) {
         $checkindate = date('Y-m-d', strtotime($formvalues['datein']));
         $checkintime = date('H:i:s', strtotime($formvalues['timein']));
         $checkinfulldate = $checkindate . ' ' . $checkintime;
         debugMessage('checkin: ' . $checkinfulldate);
         // if user is already checkin, throw exception
         if (isCheckedIn($formvalues['userid'], $checkindate)) {
             $message = "Check-In failed. Active session already exists";
             $session->setVar(ERROR_MESSAGE, $message);
             exit;
         }
         $hasshift = false;
         $scheduleentry = getSessionEntry($user->getID());
         // debugMessage($scheduleentry);
         if (!isEmptyString($scheduleentry['id']) && !isEmptyString($user->getShift()) && $scheduleentry['status'] == 1) {
             $hasshift = true;
         }
         if ($hasshift) {
             $shift = new ShiftSchedule();
             $shift->populate($scheduleentry['id']);
             // debugMessage($shift->toArray());
             $validstartdate = $checkindate;
             $validstarttime = !isEmptyString($shift->getStartTime()) ? $shift->getStartTime() : $shift->getSession()->getStartTime();
             $validfullstartdate = $validstartdate . ' ' . $validstarttime;
             debugMessage('startin: ' . $validfullstartdate);
             # compute end date and time
             $endtime = !isEmptyString($shift->getEndTime()) ? $shift->getEndTime() : $shift->getSession()->getEndTime();
             $endday = $checkindate;
             $starthr = date('H', strtotime($validstarttime));
             //debugMessage($starthr);
             $endhr = date('H', strtotime($endtime));
             //debugMessage($endhr);
             if ($endhr < $starthr) {
                 $nxtday = date('Y-m-d', strtotime($checkindate . " + 1 day"));
                 $endday = $nxtday;
             }
             $validenddate = $endday;
             $validendtime = $endtime;
             $validfullenddate = $validenddate . ' ' . $validendtime;
             debugMessage('ending: ' . $validfullenddate);
             // validate start and end dates for each session
             $rangevalid = false;
             if (strtotime($checkinfulldate) >= strtotime($shift->getStartDate() . ' 00:00:00')) {
                 $rangevalid = true;
                 if (!isEmptyString($shift->getEndDate())) {
                     $rangevalid = false;
                     if (strtotime($checkinfulldate) <= strtotime($shift->getEndDate() . ' 23:00:00')) {
                         $rangevalid = true;
                     }
                 }
             }
             // also check if the days of the week are in the valid range
             if ($rangevalid) {
                 $todaywkno = date('w', strtotime($checkinfulldate));
                 // debugMessage($todaywkno);
                 $wkdaysprofiled = $user->getDaysOfWeekArray();
                 // debugMessage($wkdaysprofiled);
                 if (!isEmptyString($scheduleentry['workingdays'])) {
                     $wkdaysprofiled = explode(',', preg_replace('!\\s+!', '', trim($scheduleentry['workingdays'])));
                     // debugMessage($wkdaysprofiled);
                 }
                 if (count($wkdaysprofiled) > 0) {
                     if (!in_array($todaywkno, $wkdaysprofiled)) {
                         $rangevalid = false;
                     }
                 }
             }
             // now validate the time within the session
             if ($rangevalid) {
                 if (strtotime($checkinfulldate) >= strtotime($validfullstartdate) && strtotime($checkinfulldate) < strtotime($validfullenddate)) {
                     $validshift = true;
                     $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());
                     $formvalues['sessionid'] = $scheduleentry['sessionid'];
//.........这里部分代码省略.........
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:101,代码来源:TimesheetsController.php


注:本文中的UserAccount::populate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。