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


PHP My_Model类代码示例

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


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

示例1: init

 /**
  * 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'));
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym3,代码行数:28,代码来源:AdvancedInfoFormPart3.php

示例2: getUser

 /**
  * 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;
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym1,代码行数:10,代码来源:Action.php

示例3: preDispatch

 /**
  *
  * @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');
     }
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym3,代码行数:35,代码来源:Acl.php

示例4: init

 /**
  * 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());
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym3,代码行数:29,代码来源:AdvancedInfoFormPart1.php

示例5: registrationAction

 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;
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym1,代码行数:27,代码来源:AdminController.php

示例6: getInstance

 /**
  * Vrati instanci modelu
  *
  * @return My_Model
  */
 public static function getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym1,代码行数:12,代码来源:Model.php

示例7: preDispatch

 /**
  *
  * @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');
     }
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym1,代码行数:39,代码来源:Acl.php

示例8: indexAction

 /**
  * 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");
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym3,代码行数:16,代码来源:AdminController.php

示例9: init

 /**
  * 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'));
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym3,代码行数:55,代码来源:AdvancedInfoForm.php

示例10: deleteAction

 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/');
     }
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym3,代码行数:15,代码来源:TestController.php

示例11: __construct

 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();
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym1,代码行数:15,代码来源:QuestionForm.php

示例12: setFiles

 /**
  * 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;
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym3,代码行数:25,代码来源:Applicant.php

示例13: init

 /**
  * 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'));
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym3,代码行数:51,代码来源:ApplicantForm.php

示例14: indexAction

 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;
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym1,代码行数:18,代码来源:AttachmentsController.php

示例15: init

 /**
  * 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'));
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym1,代码行数:25,代码来源:ProductForm.php


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