/** Set the institution * @access public * @return \Pas_View_Helper_Institution */ public function setInstitution($institution) { if (!is_null($institution)) { $institutions = new Institutions(); $institution = $institutions->fetchRow($institutions->select()->where('institution = ?', $institution)); if (!is_null($institution)) { $this->_institution = $institution->description; } } return $this; }
public function institution($inst) { if (!is_null($inst)) { $institutions = new Institutions(); $institution = $institutions->fetchRow($institutions->select()->where('institution = ?', $inst)); if (!is_null($institution)) { return $institution->description; } } else { return 'The Portable Antiquities Scheme'; } }
/** Create the institution * @todo perhaps move out to another class * @param type $inst * @return string */ public function institution($inst) { if (!is_null($inst)) { $institutions = new Institutions(); $where = array(); $where[] = $institutions->getAdapter()->quoteInto('institution = ?', $inst); $institution = $institutions->fetchRow($where); if (!is_null($institution)) { return $institution->description; } } else { return 'The Portable Antiquities Scheme'; } }
/** Edit an institution * @access public * @return void */ public function editAction() { $form = new InstitutionForm(); $form->details->setLegend('Edit institution details: '); $this->view->form = $form; if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) { if ($form->isValid($form->getValues())) { $where = array(); $where[] = $this->_institutions->getAdapter()->quoteInto('id = ?', $this->getParam('id')); $this->_institutions->update($form->getValues(), $where); $this->getFlash()->addMessage($form->getValue('institution') . '\'s details updated.'); $this->redirect($this->_redirectUrl . 'institutions/'); } else { $form->populate($form->getValues()); } } else { // find id is expected in $params['id'] $id = (int) $this->_request->getParam('id', 0); if ($id > 0) { $this->view->inst = $this->_institutions->fetchRow('id=' . $id)->toArray(); $form->populate($this->_institutions->fetchRow('id=' . $id)->toArray()); } } }