public function &__get($name) { $value = parent::__get($name); if (@unserialize($value)) { $value = unserialize($value); } return $value; }
public function __construct($request) { if (count($request->getParams()) == 0) { return; } $controller = strtolower($request->controller); $action = strtolower($request->action); $ss = new Zend_Session_Namespace('member'); $role = $ss->__get('Role'); if ($role[$controller][$action] != 1) { if ($ss->__get('Member')) { $ss->__get('Member')->log('Access denied: ' . $controller . '-' . $action, $controller); } $ss = new Zend_Session_Namespace('permission'); $ss->splash = 'You do not have permission accept to this section. Please contact Supper Administrator!'; header('location: /admin/'); } }
/** * Check authorizatioin. if user is not logged in redirect him to login */ public function init() { parent::init(); $auth = Zend_Auth::getInstance(); $auth->setStorage(new Zend_Auth_Storage_Session('user')); if (!$auth->hasIdentity()) { $this->_redirect('/'); } $session = new Zend_Session_Namespace('userObj'); $this->userObj = $session->__get('userObj'); }
public static function getSplash() { $ss = new Zend_Session_Namespace('Splash'); $mesage = $ss->__get('splash'); if ($mesage['message']) { $html = ' <div id="splash" class="response-msg ' . $mesage['code'] . ' ui-corner-all" style="width:40%;margin:0 auto;">' . $mesage['message'] . '</div> <script> setTimeout(\'$("#splash").fadeOut("slow")\',' . $mesage['timer'] . '); </script>'; } $ss->__set('splash', array()); return $html; }
/** * __get() - method to get a variable in this object's current namespace * * @param string $name - programmatic name of a key, in a <key,value> pair in the current namespace * @return mixed */ public function &__get($name) { if ($this->_persistObject) { $data = parent::_namespaceGet($this->_namespace); if (is_object($data)) { $method = 'get' . $name; if (method_exists($data, $method)) { return $data->{$method}(); } else { if (isset($data->{$name})) { return $data->{$name}; } } } } return parent::__get($name); }
public function addgroupAction() { $app = $this->view->baseUrl(); $this->view->pageTitle = "Group"; $this->view->title = "Group"; $addForm = new Groupmdefault_Form_groupdefault($app); $this->view->form = $addForm; $convertdate = new App_Model_dateConvertor(); $sessionName = new Zend_Session_Namespace('groupsession'); if (isset($sessionName)) { $this->view->gtype = $sessionName->__get('grouptype'); $addForm->office->setValue($sessionName->__get('office')); $addForm->groupname->setValue($sessionName->__get('groupname')); $addForm->bank->setValue($sessionName->__get('bank')); $addForm->savingamt->setValue($sessionName->__get('savingamt')); $addForm->penaltylate->setValue($sessionName->__get('penaltylate')); // $addForm->penaltyabsence->setValue($sessionName->__get('penaltyabsence')); $addForm->interest->setValue($sessionName->__get('interest')); $addForm->place->setValue($sessionName->__get('place')); $addForm->times->setValue($sessionName->__get('times')); $addForm->day->setValue($sessionName->__get('day')); $cdate = $sessionName->__get('Created_Date'); if ($cdate) { $addForm->Created_Date->setValue($cdate); } unset($sessionName->office); unset($sessionName->groupname); unset($sessionName->bank); unset($sessionName->savingamt); unset($sessionName->penaltylate); unset($sessionName->penaltyabsence); unset($sessionName->interest); unset($sessionName->place); unset($sessionName->times); unset($sessionName->day); unset($sessionName->Created_Date); } if ($this->_request->getParam('error')) { // display error message for wrong head selection $error = $this->_request->getParam('error'); if ($error == 1) { $this->view->error = "Improper Group head selection ! "; } if ($error == 2) { $this->view->error = "Choose single member in a family ! "; } if ($error == 3) { $this->view->error = "Improper Group representative selection ! "; } if ($error == 4) { $this->view->error = "Maximum 3 members can be a representatives in a single group! "; } if ($error == 5) { $this->view->error = "Choose Bank branch name"; } } // $dbobj = new Groupmdefault_Model_Groupdefault(); $param = 'id,name'; $days = $this->view->adm->getdropdownRecord("ourbank_master_weekdays", $param); foreach ($days as $day) { $addForm->day->addMultiOption($day['id'], $day['name']); } /* $bank = $this->view->adm->viewRecord("ourbank_master_bank","id","ASC"); foreach($bank as $banks) { $addForm->bank->addMultiOption($banks['id'],$banks['name']); } */ $hierarchy = $this->view->dbobj->getofficehierarchy(); foreach ($hierarchy as $hiearchyids) { $hiearchyid = $hiearchyids['hierarchyid']; } $param = 'id,name'; $officedetails = $this->view->adm->getdropdownRecordc('ourbank_office', $param, 'officetype_id', $hiearchyid); foreach ($officedetails as $officeiddetails) { $addForm->office->addMultiOption($officeiddetails['id'], $officeiddetails['name']); } }
/** * Get the currently loggin in user * * @return \Gems_User_User */ public final function getCurrentUser() { if (!self::$currentUser) { if ($this->session->__isset('__user_definition')) { $defName = $this->session->__get('__user_definition'); // Check for during upgrade. Remove for version 1.6 if (substr($defName, -10, 10) != 'Definition') { $defName .= 'Definition'; } self::$currentUser = $this->_loadClass('User', true, array($this->session, $this->_getClass($defName))); } else { if (\MUtil_Console::isConsole()) { if (!$this->project->isConsoleAllowed()) { echo "Accessing " . GEMS_PROJECT_NAME . " from the command line is not allowed.\n"; exit; } $request = \Zend_Controller_Front::getInstance()->getRequest(); if ($request instanceof \MUtil_Controller_Request_Cli && $request->hasUserLogin()) { $user = $this->getUser($request->getUserName(), $request->getUserOrganization()); $authResult = $user->authenticate($request->getUserPassword()); if (!$authResult->isValid()) { echo "Invalid user login data.\n"; echo implode("\n", $authResult->getMessages()); exit; } self::$currentUser = $user; } elseif ($this->project->getConsoleRole()) { // \MUtil_Echo::track($this->request->getUserName(), $this->request->getUserOrganization()); self::$currentUser = $this->loadUser(self::USER_CONSOLE, 0, '(system)'); } } if (!self::$currentUser) { self::$currentUser = $this->getUser(null, self::SYSTEM_NO_ORG); } self::$currentUser->setAsCurrentUser(); } } return self::$currentUser; }
function init() { $Member = new My_Plugin_Auth($this->getRequest()); $ss = new Zend_Session_Namespace('member'); $this->Member = $ss->__get('Member'); }
/** * The Ajax Post method where above method post request is submited to save * a patient and his tests */ public function postorderAction() { $session = new Zend_Session_Namespace('userObj'); $userObj = $session->__get('userObj'); // This page only visible to operator if ($userObj['user_type'] == 'operator') { $data = $this->getRequest()->getPost(); $forms = Zend_Registry::get('forms'); $form = new Zend_Form($forms->orders->adduser); if ($form->isValid($data)) { $patient = new Application_Model_Patient(); if ($patient->check_mrn($data)) { $result = $patient->save($data); $erro_data['id'] = $result['id']; $erro_data['order_id'] = $result['order_id']; $erro_data['messages'] = ' Successfully saved'; } else { $erro_data['messages'] = ' MRN already exists'; } } else { $erro_data['id'] = $this->_request->getParam('id', 0); $erro_data['order_id'] = $this->_request->getParam('order_id', 0); $erro_data['messages'] = ''; $messages = $form->getMessages(); foreach ($messages as $row) { $erro_data['messages'] .= (is_array($row) ? current($row) : $row) . ' '; } } } else { $erro_data['messages'] = 'You don\'t have permission to this page'; } header('Content-type: application/json'); echo json_encode($erro_data); die; }