/** * Returns the colums of the joined participants table. * @return array $cols */ public function fetchCols() { $cols = parent::fetchCols(); $cols['meeting_title'] = $this->quoteIdentifier('Meetings_Meetings', 'meeting_title'); $cols['status'] = $this->quoteIdentifier('Meetings_ParticipantStatus', 'status'); return $cols; }
/** * Returns the colums of the joined user table. * @return array $cols */ public function fetchCols() { $cols = parent::fetchCols(); $cols['role'] = $this->quoteIdentifier('Auth_Roles', 'role'); $cols['status'] = $this->quoteIdentifier('Auth_Status', 'status'); return $cols; }
/** * Returns the colums of the contributions table. * @return array $cols */ public function fetchCols() { $cols = parent::fetchCols(); $cols['participant_firstname'] = $this->quoteIdentifier('Meetings_Participants', 'firstname'); $cols['participant_lastname'] = $this->quoteIdentifier('Meetings_Participants', 'lastname'); $cols['meeting_title'] = $this->quoteIdentifier('Meetings_Meetings', 'meeting_title'); $cols['contribution_type_id'] = $this->quoteIdentifier('Meetings_ContributionTypes', 'id'); $cols['contribution_type'] = $this->quoteIdentifier('Meetings_ContributionTypes', 'contribution_type'); return $cols; }
public function setConfig($config = null) { if ($config === null) { // init the databases resource $resource = new Daiquiri_Model_Resource_Table(); $resource->setTablename('Core_Config'); $rows = $resource->fetchRows(); if (empty($rows)) { return false; } $config = array(); foreach ($rows as $row) { $keys = explode('.', $row['key']); $this->_buildConfig($config, $keys, $row['value']); } } $this->_config = new Zend_Config($config, true); return true; }
/** * Updates a column entry. * @param mixed $input int id or array with "db","table" and "column" keys * @param array $formParams * @return array $response */ public function update($input, array $formParams = array()) { if (is_int($input)) { $entry = $this->getResource()->fetchRow($input); } elseif (is_array($input)) { if (empty($input['db']) || empty($input['table']) || empty($input['column'])) { throw new Exception('Either int id or array with "db","table" and "column" keys must be provided as $input'); } $entry = $this->getResource()->fetchRowByName($input['db'], $input['table'], $input['column']); } else { throw new Exception('$input has wrong type.'); } if (empty($entry)) { throw new Daiquiri_Exception_NotFound(); } // get tables and ucds $tablesResource = new Data_Model_Resource_Tables(); $ucdsResource = new Daiquiri_Model_Resource_Table(); $ucdsResource->setTablename('Data_UCD'); // get roles $roles = array_merge(array(0 => 'not published'), Daiquiri_Auth::getInstance()->getRoles()); $form = new Data_Form_Columns(array('tables' => $tablesResource->fetchValues('name'), 'tableId' => $entry['table_id'], 'ucds' => $ucdsResource->fetchRows(), 'roles' => $roles, 'submit' => 'Update column entry', 'entry' => $entry)); // valiadate the form if POST if (!empty($formParams)) { if ($form->isValid($formParams)) { // get the form values $values = $form->getValues(); unset($values['ucd_list']); // check if the order needs to be set to NULL if ($values['order'] === '') { $values['order'] = NULL; } $values['database'] = $entry['database']; $values['table'] = $entry['table']; try { $this->getResource()->updateRow($entry['id'], $values); } catch (Exception $e) { return $this->getModelHelper('CRUD')->validationErrorResponse($form, $e->getMessage()); } return array('status' => 'ok'); } else { return $this->getModelHelper('CRUD')->validationErrorResponse($form); } } return array('form' => $form, 'status' => 'form'); }