public function editAction() { SxCms_Acl::requireAcl('survey', 'survey.edit'); if ($this->getRequest()->isGet()) { $survey_id = (int) $this->_getParam('id'); $proxy = new SxCms_Survey_DataMapper(); $this->_survey = $proxy->getSurveyById($survey_id); } if ($this->getRequest()->isPost()) { $timePublished = $this->_getParam('timePublishedH') . ':' . $this->_getParam('timePublishedI') . ':00'; $timeExpired = $this->_getParam('timeExpiredH') . ':' . $this->_getParam('timeExpiredI') . ':00'; $this->_survey->SetTitle($this->_getParam('title'))->setDescription($this->_getParam('description'))->setDatePublished($this->_getParam('datePublished'))->setTimePublished($timePublished)->setDateExpired($this->_getParam('dateExpired'))->setTimeExpired($timeExpired); /* validate post */ if ($this->_survey->isValid()) { $this->_survey->save(); $flashMessenger = $this->_helper->getHelper('FlashMessenger'); $flashMessenger->addMessage('EnquĂȘte werd succesvol aangepast!'); $this->_helper->redirector->gotoSimple('index', 'survey'); } } $this->view->messages = Sanmax_MessageStack::getInstance('SxCms_Survey'); $this->view->survey = $this->_survey; $this->view->question = new SxCms_Survey_Question(); $this->view->answer = new SxCms_Survey_Question_Answer(); }
public function editAction() { SxCms_Acl::requireAcl('block', 'block.edit'); $proxy = new SxModule_Contentblock_Proxy(); $block = $proxy->getById((int) $this->_getParam('id'), $_SESSION['System']['lng']); $block->setTmx($this->tmx); if ($this->getRequest()->isPost()) { $mapper = new SxModule_Contentblock_Mapper(); $fields = $mapper->fromInput($this->_getAllParams(), $this->_editablefields()); $data = $mapper->toObject($fields, $block); $validator = new SxModule_Contentblock_Validator(); if ($validator->validate($data)) { $block->save($this->_editablefields()); $cache = Zend_Registry::get('cache'); $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('SxModule_Contentblock')); $flashMessenger = $this->_helper->getHelper('FlashMessenger'); $flashMessenger->addMessage($this->admin_tmx->_('contentblockedited')); $this->_helper->redirector->gotoSimple('index', 'contentblock'); } $item = $data; } $this->view->block = $block; $this->view->hidden = 'hidden'; $this->view->messages = Sanmax_MessageStack::getInstance('SxModule_Contentblock'); }
public function updateAction() { //SxCms_Acl::requireAcl('subscriptions', 'subscription.update'); $subscription_id = $this->_getParam('id'); $proxy = new SxCms_Event_Subscription_DataMapper(); $subscription = $proxy->getSubscriptionById($subscription_id); $proxyEvents = new SxCms_Event_DataMapper(); $event = $proxyEvents->getEventById($subscription->getEventId()); if ($this->getRequest()->isPost()) { if ($subscription->getStatus() != $this->_getParam('status') && $this->_getParam('status') == 1) { $subscription->sendConfirmation(); } $subscription->setStatus($this->_getParam('status')); $subscription->save(); foreach ($event->getFields() as $field) { if ($field->getType() == 'checkbox') { $value = implode(';', $this->_getParam($field->getName())); } else { $value = $this->_getParam($field->getName()); } $SubF = new SxCms_Event_Subscription_Field(); $SubF->setSubscriptionId($subscription_id)->setFieldId($field->getId())->setName($field->getName())->setValue($value); $mapperSubField = new SxCms_Event_Subscription_Field_DataMapper(); if ($mapperSubField->checkIfExists($SubF)) { $SubF->update(); } else { $SubF->save(); } } $this->_helper->redirector->gotoSimple('list', 'event_subscription', null, array('id' => $event->getId())); } $this->view->subscription = $subscription; $this->view->event = $event; $this->view->messages = Sanmax_MessageStack::getInstance('SxCms_Event_Subscription'); }
public function editAction() { SxCms_Acl::requireAcl('group', 'group.edit'); $mapper = new SxCms_Group_DataMapper(); $group = $mapper->getById($this->_getParam('id')); if ($this->getRequest()->isPost()) { $group->setId($this->_getParam('id'))->setName($this->_getParam('name'))->setIdentifier($this->_getParam('identifier')); $acl = $group->getAcl(); $acl->removeRole($group->getName()); $acl->addRole(new Zend_Acl_Role($group->getName())); foreach ($this->_getParam('acl') as $resourceId => $priveleges) { if (!$acl->has($resourceId)) { $acl->add(new Zend_Acl_Resource($resourceId)); } $acl->allow($group->getName(), $resourceId, $priveleges); } $group->setAcl($acl); $validator = new SxCms_Group_BaseValidator(); if ($validator->validate($group)) { $mapper = new SxCms_Group_DataMapper(); $mapper->save($group); $flashMessenger = $this->_helper->getHelper('FlashMessenger'); $flashMessenger->addMessage($this->admin_tmx->_('usergroupsaved')); $this->_helper->redirector->gotoSimple('index', 'group'); } } $xml = simplexml_load_file(APPLICATION_PATH . '/var/acl-resources.xml'); $this->view->acl = $xml; $this->view->group = $group; $this->view->messages = Sanmax_MessageStack::getInstance('SxCms_Group'); }
public function addListAction() { $fieldId = $this->_getParam('fieldId'); $key = $this->_getParam('key'); if ($key != '') { $field = $this->_fields[$fieldId]; $list = $field->getList($key); } else { $list = new SxCms_Event_Field_List(); } if ($this->getRequest()->isPost()) { $list->setEventFieldId($this->_getParam('fieldId'))->setLabel(trim($this->_getParam('label')))->setValue(trim($this->_getParam('value'))); if (!Sanmax_MessageStack::getInstance('SxCms_Event_Field_List')->getNamespaceMessages()) { if ($key != "") { $field = $this->_fields[$fieldId]; $field->removeList($key); } $field = $this->_fields[$list->getEventFieldId()]; $field->addList($list, $key); } } $this->view->event = $this->_event; $this->view->list = $list; $this->_helper->layout()->disableLayout(); $this->render('listtable'); }
public function validate(SxModule_Members_Email $object) { $msgr = Sanmax_MessageStack::getInstance($this->_namespace); if (!$msgr->getNamespaceMessages()) { return true; } return false; }
public function validate(Webshop_Subcategory $object) { $this->validateTextRequired($object->getName(), 'name', 'content'); $msgr = Sanmax_MessageStack::getInstance($this->_namespace); if (!$msgr->getNamespaceMessages()) { return true; } return false; }
public function validate(SxModule_Sheets_Subtype $object) { $this->validateTextRequired($object->getName(), 'name', 'settings', $this->_namespace); $msgr = Sanmax_MessageStack::getInstance($this->_namespace); if (!$msgr->getNamespaceMessages()) { return true; } return false; }
public function validateCompanyId($company_id) { $validator = new Zend_Validate_Callback('is_numeric'); if ($validator->isValid((int) $company_id)) { return true; } $msg = Sanmax_MessageStack::getInstance($this->_messagestack_name()); $msg->addMessage('pf_company_id', $validator->getMessages(), 'common'); return false; }
protected function _validateIdentifier() { $validator = new Zend_Validate_StringLength(2, 255); if ($validator->isValid($this->_group->getIdentifier())) { return true; } $msg = Sanmax_MessageStack::getInstance('SxCms_Group'); $msg->addMessage('identifier', $validator->getMessages()); return false; }
/** * Validates job description * * @return boolean */ protected function _validateDescription() { $validator = new Zend_Validate_StringLength(2); if ($validator->isValid($this->category->getDescription())) { return true; } $msg = Sanmax_MessageStack::getInstance('SxCms_Job_Category'); $msg->addMessage('description', $validator->getMessages()); return false; }
public function validate(SxModule_Contentblock $object) { $this->validateTextRequired($object->getTitle(), 'title', 'content'); $this->validateLongTextareaRequired($object->getContent(), 'content', 'content'); $msgr = Sanmax_MessageStack::getInstance($this->_namespace); if (!$msgr->getNamespaceMessages()) { return true; } return false; }
public function validateType($type) { $validator = new Zend_Validate_StringLength(2, 255); if ($validator->isValid($type)) { return true; } $msg = Sanmax_MessageStack::getInstance($this->_messagestack_name()); $msg->addMessage('pf_type', $validator->getMessages(), 'common'); return false; }
/** * Validates the password * * @return boolean */ protected function _validateOldPassword() { $db = Zend_Registry::get('db'); $select = $db->select()->from(array('u' => 'User'), array('*'))->where('u.user_id = ' . (int) $this->_user->getId())->where('u.password = ?', sha1($this->_oldPassword)); if (!$db->fetchRow($select)) { $msg = Sanmax_MessageStack::getInstance('SxCms_User'); $msg->addMessage('old_password', array('mismatch' => 'Waarde komt niet overeen'), 'password'); return false; } return true; }
public function indexAction() { SxCms_Acl::requireAcl('filemanager', 'filemanager.index'); $base = APPLICATION_PATH . '/../public_html/files/'; $base = realpath($base); $path = base64_decode($this->_getParam('path')); if ($this->getRequest()->isPost()) { if (null !== $this->_getParam('folder')) { SxCms_Acl::requireAcl('filemanager', 'filemanager.add.folder'); if (strlen($this->_getParam('folder'))) { $dirname = $path . '/' . $this->_getParam('folder'); mkdir($base . $dirname); $this->_redirect('/admin/filemanager/index/path/' . base64_encode($path)); } } else { SxCms_Acl::requireAcl('filemanager', 'filemanager.add.file'); $adapter = new Zend_File_Transfer_Adapter_Http(); $adapter->setDestination(realpath($base) . $path); if ($adapter->receive()) { $filename = realpath($adapter->getFileName('filename')); $file = new SxCms_File($filename); $path = $file->getPathnameFromBase(); $nfile = $path . '/' . $file->getBasename(); $this->_redirect('/admin/filemanager/edit/file/' . base64_encode($nfile) . '/path/' . base64_encode($path)); } else { $msg = Sanmax_MessageStack::getInstance('SxCms_Filemanager'); $msg->addMessage('file', $adapter->getMessages()); } } } $this->view->messages = Sanmax_MessageStack::getInstance('SxCms_Filemanager'); try { $it = new SxCms_Filesystem(realpath($base . $path)); } catch (Exception $e) { $it = new SxCms_Filesystem($base); $path = ''; $e; } $topdir = explode('/', $path); if (count($topdir) > 1) { array_pop($topdir); $topdir = implode('/', $topdir); } else { $topdir = ''; } $this->view->files = $it; $this->view->path = $path; $this->view->showpath = explode('/', $path); $this->view->topdir = $topdir; if ($this->_getParam('full')) { $this->_helper->layout->setLayout('nolayout'); $this->view->full = true; } }
public function validate(Webshop_Product $object) { $this->validateTextRequired($object->getName(), 'name', 'content'); $this->validateTextRequired($object->getImage(), 'image', 'general'); $this->validateTextareaRequired($object->getInfo(), 'info', 'content'); $msgr = Sanmax_MessageStack::getInstance($this->_namespace); if (!$msgr->getNamespaceMessages()) { return true; } return false; }
/** * Validates the password * * @return boolean */ protected function _validatePassword() { $validator = new Sanmax_Validate_PasswordStrength(); $validator->setRequireDigit(false)->setRequireLowercase(false)->setRequireUppercase(false); $msg = Sanmax_MessageStack::getInstance('SxCms_User'); if (!$validator->isValid($this->_user->getPassword())) { $msg->addMessage('password', $validator->getMessages()); return false; } return false == $msg->getMessages('password'); }
public function validate(SxModule_Eyecatchers $object) { $this->validateTextRequired($object->getTitle(), 'title', 'content'); $this->validateTextRequired($object->getSubtitle(), 'subtitle', 'content'); $msgr = Sanmax_MessageStack::getInstance($this->_namespace); if (!$msgr->getNamespaceMessages()) { return true; } else { return false; } }
public function validate(SxModule_Webtv $object) { $this->validateTextRequired($object->getTitle(), 'title', 'settings', $this->_namespace); $this->validateTextRequired($object->getYoutube(), 'youtube', 'settings', $this->_namespace); $this->validateTextRequired($object->getDatePublished(), 'date_published', 'settings', $this->_namespace); $this->validateTextRequired($object->getDescription(), 'description', 'content', $this->_namespace); $msgr = Sanmax_MessageStack::getInstance($this->_namespace); if (!$msgr->getNamespaceMessages()) { return true; } return false; }
public function validate(SxModule_Members $object) { $this->validateTextRequired($object->getName(), 'name', 'settings', $this->_namespace); $this->validateTextRequired($object->getFirstName(), 'first_name', 'settings', $this->_namespace); $this->validateEmail($object->getEmail(), 'email', 'settings', $this->_namespace); $this->validatePassword($object->getPassword(), 'password', 'settings', $this->_namespace); $msgr = Sanmax_MessageStack::getInstance($this->_namespace); if (!$msgr->getNamespaceMessages()) { return true; } return false; }
public function validate(SxModule_Subscribe $object) { $this->validateTextRequired($object->getName(), 'name', 'content', $this->_namespace); $this->validateTextRequired($object->getfirstname(), 'firstname', 'content', $this->_namespace); $this->validateEmail($object->getEmail(), 'email', 'content', $this->_namespace); $msgr = Sanmax_MessageStack::getInstance($this->_namespace); if (!$msgr->getNamespaceMessages()) { return true; } else { return false; } }
/** * Validate comment's data * * @return boolean */ public function validate(SxCms_Comment $comment) { $this->comment = $comment; $this->_validateName(); $this->_validateEmail(); $this->_validateWebsite(); $this->_validateMessage(); $msgr = Sanmax_MessageStack::getInstance('SxCms_Comments'); foreach ($this->errors as $key => $messages) { $msgr->addMessage($key, $messages, 'edit'); } return count($this->errors) === 0; }
public function validate(SxModule_Contact $object) { $this->validateTextRequired($object->getName(), 'name', null, $this->tmx->_('error.name')); $this->validateTextRequired($object->getFirstName(), 'first_name', null, $this->tmx->_('error.firstname')); $this->validateEmail($object->getEmail(), 'email', null, $this->getEmailmessages($this->tmx->_('error.email'))); $this->validateText($object->getPhone(), 'phone', null, $this->tmx->_('error.phone')); $this->validateTextareaRequired($object->getMessage(), 'message', null, $this->tmx->_('error.message')); $msgr = Sanmax_MessageStack::getInstance($this->_namespace); if (!$msgr->getNamespaceMessages()) { return true; } return false; }
protected function _validateUrl() { $val = new Zend_Validate_StringLength(); $val->setMin(1); $val->setMax(255); $val->setMessage('Dit is verplicht in te vullen', Zend_Validate_StringLength::TOO_SHORT); $val->setMessage('Oops dit is te lang', Zend_Validate_StringLength::TOO_LONG); if ($val->isValid($this->_agenda->getUrl())) { return true; } $msg = Sanmax_MessageStack::getInstance('SxModule_Doctor_Agenda'); $msg->addMessage('url', $validator->getMessages()); return false; }
public function validate(SxModule_Subscribe_Email $object) { //var_dump($object); exit; $this->validateTextRequired($object->getSubject(), 'subject', 'content', $this->_namespace); $this->validateTextRequired($object->getContent(), 'content', 'content', $this->_namespace); $this->validateTextRequired($object->getFromName(), 'from_name', 'content', $this->_namespace); $this->validateTextRequired($object->getReplyName(), 'reply_name', 'content', $this->_namespace); $this->validateEmail($object->getFromEmail(), 'from_email', 'content', $this->_namespace); $this->validateEmail($object->getReply(), 'reply', 'content', $this->_namespace); $msgr = Sanmax_MessageStack::getInstance($this->_namespace); if (!$msgr->getNamespaceMessages()) { return true; } else { return false; } }
public function editAction() { $id = $this->_getParam('id'); $proxy = new SxModule_Doctor_Agenda_Proxy(); $item = $proxy->getById($id, $_SESSION['System']['lng']); if ($this->getRequest()->isPost()) { $this->_agenda = $item; $this->_agenda->setName($this->_getParam('name')); $this->_agenda->setUrl($this->_getParam('url')); $this->_agenda->setLng($_SESSION['System']['lng']); $validator = new SxModule_Doctor_Agenda_BaseValidator(); if ($validator->validate($this->_agenda)) { $this->_agenda->save(); $flashMessenger = $this->_helper->getHelper('FlashMessenger'); $flashMessenger->addMessage('Item werd succesvol aangepast!'); $this->_helper->redirector->gotoSimple('index', 'doctor_agenda', 'admin', array('did' => $this->_getParam('did'))); } } $this->view->item = $item; $this->view->hidden = 'hidden'; $this->view->messages = Sanmax_MessageStack::getInstance('SxModule_Doctor_Agenda'); $this->view->did = $this->_getParam('did'); }
public function isValid() { $this->validateTitle(); $this->validateDescription(); if (!Sanmax_MessageStack::getInstance('SxCms_Product_Category')->getNamespaceMessages()) { return true; } return false; }
public function profileAction() { $proxy = new SxCms_Page_Proxy(); $this->view->page = $proxy->getPageById('29', null, $this->_getParam('lng', 'nl')); //enable groups if they can choose them /* $proxy = new SxModule_Securedocs_Group_Proxy(); $groups = $proxy->getAll(); $this->view->groups = $groups; */ $identity = Zend_Auth::getInstance()->getIdentity(); $proxy = new SxModule_Members_Proxy(); $item = $proxy->getById($identity->getId()); if ($this->getRequest()->isPost()) { $item->setActive($this->_getParam('active')); $item->setLng($_SESSION['System']['lng']); //$this->_getParam('language') $item->setSex($this->_getParam('sex')); $item->setName($this->_getParam('name')); $item->setFirstName($this->_getParam('firstname')); $item->setCompany($this->_getParam('company')); $item->setWebsite($this->_getParam('website')); $item->setEmail($this->_getParam('email')); $item->setPassword($this->_getParam('password')); $item->setPhone($this->_getParam('phone')); $item->setFax($this->_getParam('fax')); $item->setMobilePhone($this->_getParam('mobilephone')); $item->setStreet($this->_getParam('street')); $item->setNumber($this->_getParam('number')); $item->setPostalcode($this->_getParam('postalcode')); $item->setPlace($this->_getParam('place')); $item->setCountry($this->_getParam('country')); $item->setBoardMember($this->_getParam('boardmember')); $item->setGroups($this->_getParam('groups')); //groups = array; /* validate post */ if ($item->isValid()) { $item->save(); $item->sendToAdmin(); $this->view->success = "Aanpassingen succesvol opgeslagen"; } } $this->view->messages = Sanmax_MessageStack::getInstance('SxModule_Members'); $this->view->item = $item; }
public function isValid() { $this->validateBetween($this->_from, 'from', 'settings'); $this->validateBetween($this->_till, 'till', 'settings'); $this->validateBetween($this->_title, 'title', 'content'); $this->validateMinimum($this->_content, 'content', 'content', '2'); return count(Sanmax_MessageStack::getInstance('SxModule_Events')->getNamespaceMessages()) == 0; }
/** * Validates expiration date * * @return boolean */ protected function _validatePublicationDate() { $validator = new Zend_Validate_Date(); $validator->setFormat('dd-MM-YYYY'); if (!$validator->isValid($this->_job->getPublicationDate())) { $msg = Sanmax_MessageStack::getInstance('SxCms_Job'); $msg->addMessage('publication_date', $validator->getMessages(), 'save'); return false; } return true; }