Пример #1
0
 /** Get the last hoard record created by a specific user
  * @access public
  * @param integer $userId
  * @return array
  * @todo Needs modification for Hoards
  */
 public function getLastRecord($userId)
 {
     $fieldList = new CopyHoards();
     $fields = $fieldList->getConfig();
     $select = $this->select()->from($this->_name, $fields)->joinLeft(array('identifier' => 'people'), 'identifier.secuid = hoards.identifier1ID', array('idby' => 'fullname'))->joinLeft(array('identifierTwo' => 'people'), 'identifierTwo.secuid = hoards.identifier2ID', array('id2by' => 'fullname'))->joinLeft(array('recorder' => 'people'), 'recorder.secuid = hoards.recorderID', array('recordername' => 'fullname'))->where('hoards.createdBy = ?', (int) $userId)->order('hoards.id DESC')->limit(1);
     $select->setIntegrityCheck(false);
     return $this->getAdapter()->fetchAll($select);
 }
 /** Set up and configure the coin copying fields for cloning a record.
  * @access public
  * @return void
  */
 public function hoardAction()
 {
     $form = new ConfigureHoardCopyForm();
     $this->view->form = $form;
     $copyCoin = new CopyHoards();
     $current = $copyCoin->getConfig();
     $values = array();
     //As each value is a checkbox and we need to set as checked use 1
     foreach ($current as $cur) {
         $values[$cur] = 1;
     }
     $form->populate($values);
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             $copyCoin->updateConfig($form->getValues());
             $this->getFlash()->addMessage('Copy last record fields for hoards table updated');
             $this->redirect('/users/configuration/');
         } else {
             $form->populate($values);
         }
     }
 }