/** Set up and configure which fields you will copy when copying finds * @access public * @return void */ public function findAction() { $form = new ConfigureFindCopyForm(); $this->view->form = $form; $copyFind = new CopyFind(); $current = $copyFind->getConfig(); $values = array(); foreach ($current as $cur) { $values[$cur] = 1; } $form->populate($values); if ($this->_request->isPost()) { $formData = $this->_request->getPost(); if ($form->isValid($formData)) { $copyFind->updateConfig($form->getValues()); $this->getFlash()->addMessage('Copy last record fields for find table updated'); $this->redirect('/users/configuration/'); } else { $form->populate($values); } } }
/** Get the last record created by a specific user * @access public * @param integer $userid * @return array */ public function getLastRecord($userid) { $fieldList = new CopyFind(); $fields = $fieldList->getConfig(); $select = $this->select()->from($this->_name, $fields)->joinLeft(array('finderOne' => 'people'), 'finderOne.secuid = finds.finderID', array('finder' => 'fullname'))->joinLeft(array('finderTwo' => 'people'), 'finderTwo.secuid = finds.finder2ID', array('secondfinder' => 'fullname'))->joinLeft(array('identifier' => 'people'), 'identifier.secuid = finds.identifier1ID', array('idby' => 'fullname'))->joinLeft(array('identifierTwo' => 'people'), 'identifierTwo.secuid = finds.identifier2ID', array('id2by' => 'fullname'))->joinLeft(array('recorder' => 'people'), 'recorder.secuid = finds.finderID', array('recordername' => 'fullname'))->where('finds.createdBy = ?', (int) $userid)->order('finds.id DESC')->limit(1); $select->setIntegrityCheck(false); return $this->getAdapter()->fetchAll($select); }