/** * comments */ public function RenderAlert() { // $m = new Digitalus_View_Message(); $m = Digitalus_View_Message::getInstance(); // $ve = new Digitalus_View_Error(); $ve = Digitalus_View_Error::getInstance(); $alert = false; $message = null; $verror = null; $alert = null; if ($ve->hasErrors()) { // $verror = '<p>'. $this->view->getTranslation('The following errors have occurred') . ':</p>' . $this->view->HtmlList($ve->get()); // $alert .= '<fieldset><legend>'. $this->view->getTranslation('Errors') . '</legend>' . $verror . '</fieldset>'; $verror = "<div class='title'>Errors !!!</div>" . $this->view->HtmlList($ve->get(), false, array('class' => 'box-item')); $alert .= "<div class='box-error'>" . $verror . '</div>'; } if ($m->hasMessage()) { // $message .= '<p>' . $m->get() . '</p>'; // $alert .= '<fieldset><legend>'. $this->view->getTranslation('Message') . '</legend>' . $message . '</fieldset>'; $alert .= "<div class='tag-info'>{$m->get()}</div>"; } //after this renders it clears the errors and messages $m->clear(); $ve->clear(); return $alert; }
function init() { $this->_errors = Digitalus_View_Error::getInstance(); $this->_message = Digitalus_View_Message::getInstance(); $this->_cacheManager = Digitalus_Cache_Manager::getInstance(); $this->view->currentModuleUrl = $this->_currentModuleUrl = $this->_request->getBaseUrl() . '/' . $this->_request->getModuleName(); $this->view->currentControllerUrl = $this->_currentControllerUrl = $this->_currentModuleUrl . '/' . $this->_request->getControllerName(); $this->view->currentActionUrl = $this->_currentActionUrl = $this->_currentControllerUrl . '/' . $this->_request->getActionName(); //set Helper // $this->view->addHelperPath('Isc/View/Helper', 'Isc_View_Helper'); // $this->view->addHelperPath('Isc/View/Helper/IscFrom', 'Isc_View_Helper_IscFrom'); }
public function updatePassword($user_id, $password, $confirmationRequire = true, $confirmation = null) { $errors = Digitalus_View_Error::getInstance(); $message = Digitalus_View_Message::getInstance(); $person = $this->find($user_id)->current(); if ($person) { $person->password = md5($password); $result = $person->save(); $message->add('Updated password successfully !'); return $result; } else { $errors->add('User not exists.'); return false; } }
/** * this method takes the rawData hash and validates it according to the * rules you set in the model. this is all very simplistic by design. * * set the validation rules as parameters of the model * * $required = required fields * * $text = strip tags * * $rawText = does not strip tags * * $number = numeric * * $email = valid email * * $password = takes three parameters, the password, length, and password confirm. if confirm * is set then it validates that the two are equal * * $date = converts the date to a timestamp * * */ public function validateData() { // $this->_errors = new Digitalus_View_Error(); $this->_errors = Digitalus_View_Error::getInstance(); $validations = array('Required', 'Text', 'Integer', 'Number', 'Email', 'Password', 'Date', 'HTML', 'Unique'); foreach ($validations as $v) { $validateFunction = '_validate' . $v; $this->{$validateFunction}(); } }