/** Set up and configure the coin copying fields for cloning a record.
  * @access public
  * @return void
  */
 public function coinAction()
 {
     $form = new ConfigureCoinCopyForm();
     $this->view->form = $form;
     $copyCoin = new CopyCoin();
     $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 coin table updated');
             $this->redirect('/users/configuration/');
         } else {
             $form->populate($values);
         }
     }
 }
Exemple #2
0
 /** Retrieve all coin data from the last entered record for adding a duplicate
  * Not sure why this is in this model!
  * @access public
  * @param int $userid
  * @return array
  * @todo Move to correct model
  */
 public function getLastRecord($userid)
 {
     $fieldList = new CopyCoin();
     $fields = $fieldList->getConfig();
     $finds = $this->getAdapter();
     $select = $finds->select()->from($this->_name, $fields)->where('coins.createdBy = ?', (int) $userid)->order('coins.id DESC')->limit(1);
     return $finds->fetchAll($select);
 }