/** * Form init * */ public function init() { $this->setMethod('post'); $this->addElement('text', 'summary', array('label' => 'Summary of applicant', 'placeholder' => 'e.g. summarize applicant qualities', 'class' => 'input', 'required' => false, 'filters' => array('StringTrim'))); $seniorities = array('' => 'Select an ideal position...'); foreach (My_Model::get('Positions')->fetchAll() as $position) { $seniorities[$position->getId()] = $position->getName(); } $this->addElement('select', 'ideal_for', array('label' => 'Ideal for*', 'class' => 'input', 'required' => false, 'filters' => array('StringTrim'), 'multiOptions' => $seniorities)); $this->addElement('text', 'starting_date', array('label' => 'Starting date', 'icon' => 'calendar', 'placeholder' => 'e.g. 15. 02. 2016', 'class' => 'datepicker', 'required' => false)); $dateValidator = new Zend_Validate_Date('YYYY-MM-DD'); $this->getElement('starting_date')->addValidator($dateValidator); $contractForms = array('' => 'Select an ideal position...'); foreach (My_Model::get('ContractForms')->fetchAll() as $contractForm) { $contractForms[$contractForm->getId()] = $contractForm->getName(); } $this->addElement('select', 'contract_form_id', array('label' => 'Contract form ID', 'placeholder' => 'e.g. ID of contract form', 'class' => 'input', 'required' => false, 'multiOptions' => $contractForms)); $this->addElement('text', 'salary', array('label' => 'Salary', 'placeholder' => 'e.g. Salary', 'class' => 'input', 'required' => false, 'filters' => array('StringTrim'))); $numberValidator = new Zend_Validate_Digits(); $this->getElement('salary')->addValidator($numberValidator); $result = array('invitedtointerview' => 'Invited to interview', 'waitingforresponse' => 'Waiting for response', 'accepted' => 'Accepted', 'rejected' => 'Rejected', 'hired' => 'Hired', 'offerdeclined' => 'Offer declined', 'assigned' => 'Assigned', 'submitted' => 'Submitted', 'evaluated' => 'Evaluated'); $this->addElement('select', 'result', array('label' => 'Application status*', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => $result)); $this->addElement('submit', 'submit', array('ignore' => true, 'class' => 'submit', 'label' => 'Save')); }
/** * Vrati objekt prave prihlaseneho uzivatele */ protected function getUser() { //Zjištění zda je uživatel admin (kvůli viditelnosti registrace) $login = Zend_Auth::getInstance()->getIdentity(); $user = My_Model::get('Users')->getUserByEmail($login); return $user; }
/** * * @param Zend_Controller_Request_Abstract $request */ public function preDispatch(Zend_Controller_Request_Abstract $request) { $options = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getApplication()->getOptions(); $config = new Zend_Config($options); $acl = new My_Acl($config); Zend_Registry::set('ACL', $acl); $role = 'guest'; if (Zend_Auth::getInstance()->hasIdentity()) { $foundUser = My_Model::get('Users')->fetchRow(array('username = ?' => Zend_Auth::getInstance()->getIdentity())); $role = $foundUser->getRole(); } Zend_Registry::set('ROLE', $role); $controller = $request->getControllerName(); $action = $request->getActionName(); $resource = $controller; $privilege = $action; if (!$acl->has($resource)) { $resource = null; } if (is_null($privilege)) { $privilege = 'index'; } if (!$acl->isAllowed($role, $resource, $privilege)) { $flash = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger'); $flash->clearMessages(); $flash->addMessage('Access Denied'); $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector'); //throw new Exception("Insufficient privilages (".$role.",".$resource.",".$privilege.")"); $redirector->gotoSimpleAndExit('login', 'admin'); } }
function __construct() { parent::__construct(); $ci =& get_instance(); $this->table_name = $ci->config->item('db_table_prefix', 'tank_auth') . $this->table_name; $this->profile_table_name = $ci->config->item('db_table_prefix', 'tank_auth') . $this->profile_table_name; }
/** * Form init * */ public function init() { $this->setMethod('post'); $this->setDisplayForm(false); $this->addElement('text', 'interviewed_on', array('label' => 'Interviewed on*', 'icon' => 'calendar', 'placeholder' => 'e.g. 01. 01. 2016', 'class' => 'datepicker', 'required' => false)); $dateValidator = new Zend_Validate_Date('YYYY-MM-DD'); $this->getElement('interviewed_on')->addValidator($dateValidator); $users = array('' => 'Select an interviewer...'); foreach (My_Model::get('Users')->fetchAll() as $user) { $users[$user->getId()] = $user->getFirstName() . " " . $user->getLastName(); } $this->addElement('select', 'interviewed_by', array('label' => 'Interviewed by', 'class' => 'input', 'required' => false, 'multiOptions' => $users)); $this->addElement('select', 'interviewed_by2', array('label' => 'Interviewed by', 'class' => 'input', 'required' => false, 'multiOptions' => $users)); $this->addElement('select', 'interviewed_by3', array('label' => 'Interviewed by', 'class' => 'input', 'required' => false, 'multiOptions' => $users)); $this->addElement('text', 'education', array('label' => 'Education', 'placeholder' => 'e.g. High school', 'class' => 'input', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'motivation', array('label' => 'Motivation', 'placeholder' => 'e.g. Working on great product', 'class' => 'input', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'preferred_work', array('label' => 'Preferred work', 'placeholder' => 'e.g. Backend programmer', 'class' => 'input', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'ambitions', array('label' => 'Ambitions', 'placeholder' => 'e.g. John', 'class' => 'input', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'languages', array('label' => 'Languages', 'placeholder' => 'e.g. English, German', 'class' => 'input', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'travelling', array('label' => 'Travelling', 'placeholder' => 'e.g. USA, Great Britain', 'class' => 'input', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('submit', 'submit', array('ignore' => true, 'class' => 'submit', 'label' => 'Save')); $this->removeDecorator('form'); // the bit you are looking for :) Zend_Debug::dump($this->render()); }
public function registrationAction() { // Only for administrators if (!$this->getUser() || !$this->getUser()->isAdmin()) { // Redirects $this->_helper->redirector->gotoRoute(array('controller' => 'admin', 'action' => 'login'), 'default', true); return; } $this->view->title = 'Registrace administrátora'; $form = new RegistrationForm(); if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { $formValues = $form->getValues(); if ($formValues["heslo"] != $formValues["heslo2"]) { //todo barevne zvyrazeni chybnych poli + kontrola formatu //neni stejne heslo } else { //pokud už uživatel není v databázi $formValues["heslo"] = sha1("interview" . $formValues["heslo"]); $user = My_Model::get('Users')->createRow(); $user->updateFromArray($formValues); $this->_helper->redirector->gotoRoute(array('controller' => 'candidate', 'action' => 'index'), 'default', true); } } } $this->view->registrationform = $form; }
/** * Vrati instanci modelu * * @return My_Model */ public static function getInstance() { if (self::$_instance === null) { self::$_instance = new self(); } return self::$_instance; }
/** * * @param Zend_Controller_Request_Abstract $request */ public function preDispatch(Zend_Controller_Request_Abstract $request) { $options = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getApplication()->getOptions(); $config = new Zend_Config($options); $acl = new My_Acl($config); $role = 'guest'; if (Zend_Auth::getInstance()->hasIdentity()) { $role = 'user'; if (Zend_Auth::getInstance()->hasIdentity()) { return; } else { $login = Zend_Auth::getInstance()->getIdentity(); $user = My_Model::get('Users')->getUserByEmail($login); if ($user->admin == 1) { $role = 'admin'; } } } $controller = $request->getControllerName(); $action = $request->getActionName(); $resource = $controller; $privilege = $action; if (!$acl->has($resource)) { $resource = null; } if (is_null($privilege)) { $privilege = 'index'; } if (!$acl->isAllowed($role, $resource, $privilege)) { // $flash = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger'); // $flash->addMessage('Access Denied'); $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector'); $redirector->gotoSimpleAndExit('login', 'admin'); } }
function __construct() { parent::__construct(); // // $admin_userdata = $this->session->userdata(APP_PFIX . 'admin'); // if (!$admin_userdata['logged_in_admin']) { // $this->session->set_flashdata('errorlogin', "You must log in!"); // redirect('login/index'); // } }
public function rdf($row, $prefix = '') { $row->type = 'http://xmlns.com/foaf/0.1/Person'; if (isset($row->url) && !isset($row->homepage)) { $row->homepage = $row->url; unset($row->url); } if (isset($row->email) && !isset($row->mbox_sha1sum)) { $row->mbox_sha1sum = sha1('mailto:' . $row->email); } return parent::rdf($row); }
/** * Uvodni stranka * */ public function indexAction() { $username = Zend_Auth::getInstance()->getIdentity(); $this->view->userId = $username; //->User_ID; $users = My_Model::get('Users'); $rowset = $users->fetchAll($users->select()->where('username = ?', $username)); $row = $rowset->current(); $userNamespace = new Zend_Session_Namespace('User'); $userNamespace->user = $row; $this->_helper->redirector("index", "index"); }
/** * Name : __construct * Description : constructor of the class */ function __construct() { // Call the Model constructor parent::__construct(); $this->pref = array('show_next_prev' => TRUE, 'next_prev_url' => base_url() . 'admin/calendar_controller/showcal'); /* * Using codeIgniter calander function */ $this->pref['template'] = ' {table_open}<table border="0" cellpadding="0" cellspacing="0" class="calendar">{/table_open} {heading_row_start}<tr>{/heading_row_start} {heading_previous_cell}<th><a href="{previous_url}"><<</a></th>{/heading_previous_cell} {heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell} {heading_next_cell}<th><a href="{next_url}">>></a></th>{/heading_next_cell} {heading_row_end}</tr>{/heading_row_end} {week_row_start}<tr>{/week_row_start} {week_day_cell}<td>{week_day}</td>{/week_day_cell} {week_row_end}</tr>{/week_row_end} {cal_row_start}<tr class="days">{/cal_row_start} {cal_cell_start}<td class="day">{/cal_cell_start} {cal_cell_start_today}<td>{/cal_cell_start_today} {cal_cell_start_other}<td class="other-month">{/cal_cell_start_other} {cal_cell_content} <div class="day_num">{day}</div> <div class="content">{content}</div> {cal_cell_content_today} <div class="day_num highlight">{day}</div> <div class="content">{content}</div> {/cal_cell_content_today} {cal_cell_no_content}<div class="day_num">{day}</div>{/cal_cell_no_content} {cal_cell_no_content_today} <div class="day_num highlight">{day}</div> {/cal_cell_no_content_today} {cal_cell_blank} {/cal_cell_blank} {cal_cell_other}{day}{/cal_cel_other} {cal_cell_end}</td>{/cal_cell_end} {cal_cell_end_today}</td>{/cal_cell_end_today} {cal_cell_end_other}</td>{/cal_cell_end_other} {cal_row_end}</tr>{/cal_row_end} {table_close}</table>{/table_close} '; }
public function rdf($row, $prefix = '') { $row->type = 'http://xmlns.com/foaf/0.1/Person'; if (isset($row->fullname) && !isset($row->name)) { $row->name = $row->fullname; unset($row->fullname); } if (isset($row->url) && !isset($row->homepage)) { $row->homepage = $row->url; unset($row->url); } return parent::rdf($row); }
/** * Form init * */ public function init() { $this->setMethod('post'); $this->addElement('text', 'interviewed_on', array('label' => 'Date of interview', 'icon' => 'calendar', 'placeholder' => 'e.g. 2016-02-03', 'class' => 'datepicker', 'required' => false)); $dateValidator = new Zend_Validate_Date('YYYY-MM-DD'); $this->getElement('interviewed_on')->addValidator($dateValidator); $result = array('invitedtointerview' => 'Invited to interview', 'waitingforresponse' => 'Waiting for response', 'accepted' => 'Accepted', 'rejected' => 'Rejected', 'hired' => 'Hired', 'offerdeclined' => 'Offer declined', 'assigned' => 'Assigned', 'submitted' => 'Submitted', 'evaluated' => 'Evaluated'); $this->addElement('select', 'result', array('label' => 'Application status*', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => $result)); $users = array('' => 'Select an interviewer...'); foreach (My_Model::get('Users')->fetchAll() as $user) { $users[$user->getId()] = $user->getFirstName() . " " . $user->getLastName(); } $this->addElement('select', 'interviewed_by', array('label' => 'Interviewed by', 'class' => 'input', 'required' => false, 'multiOptions' => $users)); $this->addElement('select', 'interviewed_by2', array('label' => 'Interviewed by', 'class' => 'input', 'required' => false, 'multiOptions' => $users)); $this->addElement('select', 'interviewed_by3', array('label' => 'Interviewed by', 'class' => 'input', 'required' => false, 'multiOptions' => $users)); $this->addElement('text', 'education', array('label' => 'Education', 'placeholder' => 'e.g. High school', 'class' => 'input', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('textarea', 'motivation', array('label' => 'Motivation to change', 'placeholder' => 'e.g. Working on great product', 'class' => 'col-md-7 col-xs-1 form-control input textarea', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('textarea', 'preferred_work', array('label' => 'Kind of work preferred', 'placeholder' => 'e.g. Backend programmer', 'class' => 'col-md-7 col-xs-1 form-control input textarea', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('textarea', 'ambitions', array('label' => 'Ambitions', 'placeholder' => 'e.g. John', 'class' => 'col-md-7 col-xs-1 form-control input textarea', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'languages', array('label' => 'Languages', 'placeholder' => 'e.g. English, German', 'class' => 'col-md-7 col-xs-1 form-control input textarea', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'travelling', array('label' => 'Travelling', 'placeholder' => 'e.g. USA, Great Britain', 'class' => 'input', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('textarea', 'pluses_minuses', array('label' => 'Pluses/minuses', 'placeholder' => 'e.g. +hard working ', 'class' => 'col-md-7 col-xs-1 form-control input textarea', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('textarea', 'team_experience', array('label' => 'Team work experience', 'placeholder' => 'e.g. Team 10+ ppl ', 'class' => 'col-md-7 col-xs-1 form-control input textarea', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('textarea', 'domain', array('label' => 'Main domain/areas of work', 'placeholder' => 'e.g. Backend project', 'class' => 'col-md-7 col-xs-1 form-control input textarea', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('textarea', 'knowhow', array('label' => 'Skills and technologies knowhow', 'placeholder' => 'e.g. SQL, JS', 'class' => 'col-md-7 col-xs-1 form-control input textarea', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('textarea', 'other', array('label' => 'Other information', 'placeholder' => 'e.g. makes great coffee', 'class' => 'col-md-7 col-xs-1 form-control input textarea', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('textarea', 'summary', array('label' => 'Summary of the interview', 'placeholder' => 'e.g. summarize applicant qualities', 'class' => 'col-md-7 col-xs-1 form-control input textarea', 'required' => false, 'filters' => array('StringTrim'))); $seniorities = array('' => 'Select an ideal position...'); foreach (My_Model::get('Positions')->fetchAll() as $position) { $seniorities[$position->getId()] = $position->getName(); } $this->addElement('text', 'ideal_for', array('label' => 'Ideal for position/project', 'class' => 'input', 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'starting_date', array('label' => 'Possible starting date', 'icon' => 'calendar', 'placeholder' => 'e.g. 2016-02-04', 'class' => 'datepicker', 'required' => false)); $dateValidator = new Zend_Validate_Date('YYYY-MM-DD'); $this->getElement('starting_date')->addValidator($dateValidator); $contractForms = array('' => 'Select an ideal position...'); foreach (My_Model::get('ContractForms')->fetchAll() as $contractForm) { $contractForms[$contractForm->getId()] = $contractForm->getName(); } $this->addElement('select', 'contract_form_id', array('label' => 'Contract form', 'class' => 'input', 'required' => false, 'multiOptions' => $contractForms)); $this->addElement('text', 'salary', array('label' => 'Salary', 'placeholder' => 'e.g. Salary', 'class' => 'input', 'required' => false, 'filters' => array('StringTrim'))); $numberValidator = new Zend_Validate_Digits(); $this->getElement('salary')->addValidator($numberValidator); $salaryCurrencies = array('czk' => 'CZK', 'eur' => 'EUR'); //TODO $this->addElement('select', 'salary_currency', array('label' => 'Currency', 'class' => 'input', 'required' => false, 'multiOptions' => $salaryCurrencies)); $this->addElement('text', 'contact_date', array('label' => 'Next contact date', 'icon' => 'calendar', 'placeholder' => 'e.g. 2016-02-04', 'class' => 'datepicker', 'required' => false)); $dateValidator = new Zend_Validate_Date('YYYY-MM-DD'); $this->getElement('starting_date')->addValidator($dateValidator); $this->addElement('submit', 'submit', array('ignore' => true, 'class' => 'submit', 'label' => 'Save')); }
public function deleteAction() { // only POST request if ($this->_request->isPost()) { $id = $this->_getParam('id'); if (!empty($id)) { $test = My_Model::get('Tests')->getById($id); if ($test) { $test->deleteTest(); $this->_helper->flashMessenger->setNamespace("success")->addMessage("Test was deleted!"); } } $this->_helper->redirector->gotoUrl('/test/'); } }
public function __construct(array $params = array()) { if (array_key_exists('questionId', $params)) { $this->_question = My_Model::get('Questions')->getById($params['questionId']); } if (array_key_exists('count', $params) && intval($params['count']) > -1) { $this->_count = intval($params['count']); } $languages = My_Model::get('Languages')->fetchAll(); $this->_languages[0] = "None"; foreach ($languages as $l) { $this->_languages[$l->getid_jazyk()] = $l->getnazev(); } parent::__construct(); }
/** * Metoda ukládá soubory (file). * * Nelze rozlišit, co je čím nahrazováno. * Vše smazáno a nahráno znovu. * IDEAL: Do formuláře načíst naše data a vše při každé úpravě nahrávat znovu a znovu. * * @param unknown $files */ public function setFiles($files) { $service = My_Model::get('Files'); // smazeme prirazene rubriky $service->delete(array('applicant_id = ?' => $this->getId())); // nastavime nove foreach ($files as $file) { $name = basename($file->getFileName()); $bindata = file_get_contents($file->getFileName()); unlink($file->getFileName()); //echo '<br />----------$file --------------------------------<br />'; //Zend_Debug::dump($file); $service->insert(array('applicant_id' => $this->getId(), 'name' => $name, 'file' => $bindata, 'created_at' => date("Y-m-d H:i:s"))); } return $this; }
/** * Form init * */ public function init() { $this->setMethod('post'); $this->addElement('text', 'first_name', array('label' => 'First Name*', 'placeholder' => 'e.g. John', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('text', 'last_name', array('label' => 'Last Name*', 'placeholder' => 'e.g. Smith', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('text', 'birth_date', array('label' => 'Birth Date*', 'icon' => 'calendar', 'placeholder' => 'e.g. 1982-10-01', 'class' => 'datepicker', 'required' => true)); $dateValidator = new Zend_Validate_Date('YYYY-MM-DD'); $this->getElement('birth_date')->addValidator($dateValidator); $seniorities = array('' => 'Select a seniority...'); foreach (My_Model::get('Seniorities')->fetchAll() as $seniority) { $seniorities[$seniority->getId()] = $seniority->getName(); } $this->addElement('select', 'seniority_id', array('label' => 'Seniority*', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => $seniorities)); $technologies = array('' => 'Select a technology...'); foreach (My_Model::get('Technologies')->fetchAll() as $technology) { $technologies[$technology->getId()] = $technology->getName(); } $this->addElement('select', 'technology_id', array('label' => 'Technology*', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => $technologies)); $positions = array('' => 'Select a position...'); foreach (My_Model::get('Positions')->fetchAll() as $position) { $positions[$position->getId()] = $position->getName(); } $this->addElement('select', 'position_id', array('label' => 'Position*', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => $positions)); $fileUploader = new Zend_Form_Element_File('photo'); $fileUploader->setLabel('Photo (max 2MB, JPEG)')->setAttrib('class', 'input')->setDestination(Zend_Registry::get('uploadPath')); $fileUploader->addValidator('Count', false, 1); $fileUploader->addValidator('Size', false, 2048000); $fileUploader->addValidator('Extension', false, 'jpg,jpeg'); $this->addElement($fileUploader, 'photo'); $this->addElement('textarea', 'note', array('label' => 'Note', 'placeholder' => 'Interesting facts about the applicant...', 'class' => 'col-md-7 col-xs-1 form-control input textarea', 'filters' => array('StringTrim'))); $fileUploader = new Zend_Form_Element_File('attach1'); $fileUploader->setLabel('Attachment (max 15MB)')->setAttrib('class', 'input')->setDestination(Zend_Registry::get('uploadPath')); $fileUploader->addValidator('Count', false, 1); $fileUploader->addValidator('Size', false, 15728640); $this->addElement($fileUploader, 'attach1'); $fileUploader = new Zend_Form_Element_File('attach2'); $fileUploader->setLabel('Attachment (max 15MB)')->setAttrib('class', 'input')->setDestination(Zend_Registry::get('uploadPath')); $fileUploader->addValidator('Count', false, 1); $fileUploader->addValidator('Size', false, 15728640); $this->addElement($fileUploader, 'attach2'); $fileUploader = new Zend_Form_Element_File('attach3'); $fileUploader->setLabel('Attachment (max 15MB)')->setAttrib('class', 'input')->setDestination(Zend_Registry::get('uploadPath')); $fileUploader->addValidator('Count', false, 1); $fileUploader->addValidator('Size', false, 15728640); $this->addElement($fileUploader, 'attach3'); $this->addElement('submit', 'submit', array('ignore' => true, 'class' => 'submit', 'label' => 'Add Applicant')); }
public function indexAction() { $attachmentId = $this->_request->getParam('id'); // Disables view script call $this->_helper->viewRenderer->setNoRender(true); // Disables layout to action mapping $this->_helper->layout->disableLayout(); // Loads attachment $att = My_Model::get('Attachments')->getById($attachmentId); // Reads attachment extension $fileExtenstion = array_pop(explode(".", $att->getnazev())); // Loads mime types $mimeTypes = $this->mimeTypes(); // Sets Content type $this->_response->setHeader('Content-Type', $mimeTypes[$fileExtenstion]); // Prints mediablob echo $att->priloha; }
/** * Inicializace formulare * */ public function init() { // nastaveni metody odeslani $this->setMethod('post'); // nastaveni polozek formulare $manufacturers = array('' => '...'); foreach (My_Model::get('Manufacturers')->fetchAll() as $manufacturer) { $manufacturers[$manufacturer->getId()] = $manufacturer->getName(); } $this->addElement('select', 'manufacturer_id', array('label' => 'Výrobce:', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => $manufacturers)); $this->addElement('text', 'title', array('label' => 'Název:', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('text', 'price', array('label' => 'Cena:', 'class' => 'input', 'required' => true, 'filters' => array('Digits'), 'validators' => array('Digits', array('validator' => 'GreaterThan', 'options' => array(0))))); $this->addElement('select', 'currency', array('label' => 'Měna:', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => array('czk' => 'CZK', 'eur' => 'EUR'))); $this->addElement('textarea', 'description', array('label' => 'Popis:', 'class' => 'textarea', 'required' => true, 'filters' => array('StringTrim'))); $folders = array(); foreach (My_Model::get('Folders')->fetchAll() as $folder) { $folders[$folder->getId()] = $folder->getName(); } $this->addElement('multiCheckbox', 'folders', array('label' => 'Rubrika:', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => $folders)); $this->addElement('submit', 'submit', array('ignore' => true, 'class' => 'submit', 'label' => 'Přidat')); }
public function init() { $this->setMethod('post'); $this->addElement('text', 'name', array('label' => 'Name*', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('textarea', 'description', array('label' => 'Description', 'class' => 'col-md-7 col-xs-1 form-control input textarea', 'required' => false, 'filters' => array('StringTrim'))); $seniorities = array('' => 'Select a seniority...'); foreach (My_Model::get('Seniorities')->fetchAll() as $seniority) { $seniorities[$seniority->getId()] = $seniority->getName(); } $this->addElement('select', 'seniority_id', array('label' => 'Seniority*', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => $seniorities)); $technologies = array('' => 'Select a technology...'); foreach (My_Model::get('Technologies')->fetchAll() as $technology) { $technologies[$technology->getId()] = $technology->getName(); } $this->addElement('select', 'technology_id', array('label' => 'Technology*', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => $technologies)); $positions = array('' => 'Select a position...'); foreach (My_Model::get('Positions')->fetchAll() as $position) { $positions[$position->getId()] = $position->getName(); } $this->addElement('select', 'position_id', array('label' => 'Position*', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => $positions)); $this->addElement('submit', 'submit', array('ignore' => true, 'class' => 'submit', 'label' => 'Add Test')); }
/** * Vrací true pokud existují odpovědi k této otázce. */ public function isAnswered() { $r = My_Model::get('Responses'); $responses = $r->fetchAll($r->select()->where('id_otazka = ?', $this->getid_otazka())); return $responses->count() > 0; }
public function testGetQuestions() { $question = My_Model::get('Tests')->getById(1)->getQuestions()[0]; $this->assertNotNull($question); }
/** * Constructor * * @access public */ function Main_model() { parent::__construct(); }
public function __construct() { parent::__construct(IMS_DB_PREFIX . 'subject', 'id'); }
/** ------------------------------------- * Construct * ------------------------------------- */ public function __construct() { parent::__construct('company'); }
/** ------------------------------------- * * ------------------------------------- */ public function __construct() { parent::__construct('bill'); }
/** * Inicializace formulare * */ public function init() { $this->setMethod(self::METHOD_POST); // ################## FIRST COLUMN ################### // Photo (id_foto) // File picker $profilePhotoPicker = new Zend_Form_Element_File('profilePhoto'); $profilePhotoPicker->setDestination(PUBLIC_PATH . '/temp'); $profilePhotoPicker->addValidator('Count', false, 1); $profilePhotoPicker->addValidator('Size', false, 2097152); $profilePhotoPicker->removeDecorator('Label'); $this->addElement($profilePhotoPicker, 'profilePhoto'); $avatar = new Zend_Form_Element_Image('avatar'); $avatar->setAttrib('class', array("profile-user-img", "img-responsive", "img-circle")); $this->addElement($avatar, 'avatar'); // First name (jmeno) $firstName = $this->createElement('text', 'jmeno'); $firstName->addFilter('StringTrim'); $firstName->setRequired(true); $firstName->setAttrib('class', 'form-control'); $firstName->setAttrib('placeholder', 'First name'); $firstName->removeDecorator('Label'); $this->addElement($firstName); // Last name (prijmeni) $lastName = $this->createElement('text', 'prijmeni'); $lastName->addFilter('StringTrim'); $lastName->setRequired(true); $lastName->setAttrib('class', 'form-control'); $lastName->setAttrib('placeholder', 'Surname'); $lastName->removeDecorator('Label'); $this->addElement($lastName); // E-mail (email) $lastName = $this->createElement('text', 'email'); $lastName->addFilter('StringTrim'); $lastName->setRequired(true); $lastName->setAttrib('class', 'form-control'); $lastName->setAttrib('placeholder', 'E-mail'); $lastName->removeDecorator('Label'); $this->addElement($lastName); //heslo $pass = $this->createElement('password', 'heslo'); $pass->setAttrib('class', 'form-control'); $pass->setAttrib('placeholder', 'Password'); $pass->removeDecorator('Label'); $login = Zend_Auth::getInstance()->getIdentity(); $user = My_Model::get('Users')->getUserByEmail($login); if ($user !== NULL) { $this->addElement($pass); } // ###################### BUTTON ###################### $close = new Zend_Form_Element_Submit('closeButton'); $close->setLabel('Back'); $close->setAttrib('class', 'btn btn-default'); $close->setDecorators(array('ViewHelper')); $this->addElement($close, 'closeButton'); $save = new Zend_Form_Element_Submit('saveButton'); $save->setLabel('Save'); $save->setAttrib('class', 'btn btn-success'); $save->setDecorators(array('ViewHelper')); $this->addElement($save, 'saveButton'); $delete = new Zend_Form_Element_Submit('deleteButton'); $delete->setLabel('Delete'); $delete->setAttrib('class', 'btn btn-danger'); $delete->setAttrib('onclick', 'if (confirm("Are you sure?")) { document.form.submit(); } return false;'); $delete->setDecorators(array('ViewHelper')); $this->addElement($delete, 'deleteButton'); }
function __construct() { parent::__construct(); }
function __construct() { parent::__construct(); $this->setTable('produtos'); }