本文整理汇总了PHP中MUtil_Model_ModelAbstract::get方法的典型用法代码示例。如果您正苦于以下问题:PHP MUtil_Model_ModelAbstract::get方法的具体用法?PHP MUtil_Model_ModelAbstract::get怎么用?PHP MUtil_Model_ModelAbstract::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MUtil_Model_ModelAbstract
的用法示例。
在下文中一共展示了MUtil_Model_ModelAbstract::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addBrowseTableColumns
/**
* Adds columns from the model to the bridge that creates the browse table.
*
* Overrule this function to add different columns to the browse table, without
* having to recode the core table building code.
*
* @param \MUtil_Model_Bridge_TableBridge $bridge
* @param \MUtil_Model_ModelAbstract $model
* @return void
*/
protected function addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
{
if ($model->has('row_class')) {
$bridge->getTable()->tbody()->getFirst(true)->appendAttrib('class', $bridge->row_class);
}
if ($editMenuItem = $this->getEditMenuItem()) {
$bridge->addItemLink($editMenuItem->toActionLinkLower($this->request, $bridge));
}
// make sure search results are highlighted
$this->applyTextMarker();
if ($this->columns) {
foreach ($this->columns as $column) {
call_user_func_array(array($bridge, 'addMultiSort'), $column);
}
} elseif ($this->sortableLinks) {
foreach ($model->getItemsOrdered() as $name) {
if ($label = $model->get($name, 'label')) {
$bridge->addSortable($name, $label);
}
}
} else {
foreach ($model->getItemsOrdered() as $name) {
if ($label = $model->get($name, 'label')) {
$bridge->add($name, $label);
}
}
}
if ($deleteMenuItem = $this->findMenuItem($this->request->getControllerName(), 'delete')) {
$bridge->addItemLink($deleteMenuItem->toActionLinkLower($this->request, $bridge));
}
}
示例2: addShowTableRows
/**
* Adds rows from the model to the bridge that creates the browse table.
*
* Overrule this function to add different columns to the browse table, without
* having to recode the core table building code.
*
* @param \MUtil_Model_Bridge_VerticalTableBridge $bridge
* @param \MUtil_Model_ModelAbstract $model
* @return void
*/
protected function addShowTableRows(\MUtil_Model_Bridge_VerticalTableBridge $bridge, \MUtil_Model_ModelAbstract $model)
{
$items = $model->getItemsOrdered();
foreach ($items as $name) {
if ($model->get($name, 'type') === \MUtil_Model::TYPE_CHILD_MODEL) {
$this->submodel = $model->get($name, 'model');
$subitems = $this->submodel->getItemsOrdered();
}
}
if (isset($subitems) && is_array($subitems)) {
$items = array_diff($items, $subitems);
}
foreach ($items as $name) {
if ($label = $model->get($name, 'label')) {
$bridge->addItem($name, $label);
}
}
/*if ($subitems) {
$bridge->addItem('gctt', 'moo');
}*/
if ($model->has('row_class')) {
// Make sure deactivated rounds are show as deleted
foreach ($bridge->getTable()->tbody() as $tr) {
foreach ($tr as $td) {
if ('td' === $td->tagName) {
$td->appendAttrib('class', $bridge->row_class);
}
}
}
}
}
示例3: createModel
/**
* Creates the model
*
* @return \MUtil_Model_ModelAbstract
*/
protected function createModel()
{
// Replace two checkboxes with on radio button control
$this->model->set('ggp_staff_members', 'elementClass', 'Hidden');
$this->model->setOnSave('ggp_staff_members', array($this, 'saveIsStaff'));
$this->model->set('ggp_respondent_members', 'elementClass', 'Hidden');
$this->model->setOnSave('ggp_respondent_members', array($this, 'saveIsRespondent'));
$options = array('1' => $this->model->get('ggp_staff_members', 'label'), '2' => $this->model->get('ggp_respondent_members', 'label'));
$this->model->set('staff_respondent', 'label', $this->_('Can be assigned to'), 'elementClass', 'Radio', 'multiOptions', $options, 'order', $this->model->getOrder('ggp_staff_members') + 1);
$this->model->setOnLoad('staff_respondent', array($this, 'loadStaffRespondent'));
return $this->model;
}
示例4: addBrowseTableColumns
/**
* Adds columns from the model to the bridge that creates the browse table.
*
* Overrule this function to add different columns to the browse table, without
* having to recode the core table building code.
*
* @param \MUtil_Model_Bridge_TableBridge $bridge
* @param \MUtil_Model_ModelAbstract $model
* @return void
*/
protected function addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
{
// Make sure these fields are loaded
$model->get('gro_valid_after_field');
$model->get('gro_valid_after_id');
$model->get('gro_valid_after_length');
$model->get('gro_valid_after_source');
$model->get('gro_valid_after_unit');
$model->get('gro_valid_for_field');
$model->get('gro_valid_for_id');
$model->get('gro_valid_for_length');
$model->get('gro_valid_for_source');
$model->get('gro_valid_for_unit');
parent::addBrowseTableColumns($bridge, $model);
}
示例5: addFormElements
/**
* Adds elements from the model to the bridge that creates the form.
*
* Overrule this function to add different elements to the browse table, without
* having to recode the core table building code.
*
* @param \MUtil_Model_Bridge_FormBridgeInterface $bridge
* @param \MUtil_Model_ModelAbstract $model
*/
protected function addFormElements(\MUtil_Model_Bridge_FormBridgeInterface $bridge, \MUtil_Model_ModelAbstract $model)
{
if (!$this->createData) {
$bridge->addHidden('gtr_id_track');
}
$bridge->addText('gtr_track_name');
// gtr_track_class
if ($this->trackEngine) {
$options = $model->get('gtr_track_class', 'multiOptions');
$alternatives = $this->trackEngine->getConversionTargets($options);
if (count($alternatives) > 1) {
$options = $alternatives;
$bridge->addHidden($this->_oldClassName);
if (!isset($this->formData[$this->_oldClassName])) {
$this->formData[$this->_oldClassName] = $this->formData['gtr_track_class'];
}
$classEdit = true;
} else {
$classEdit = false;
}
} else {
$tracker = $this->loader->getTracker();
$options = $tracker->getTrackEngineList(true, true);
$classEdit = true;
}
$model->set('gtr_track_class', 'multiOptions', $options, 'escape', false);
if ($classEdit) {
$bridge->addRadio('gtr_track_class');
} else {
$bridge->addExhibitor('gtr_track_class');
}
$bridge->addDate('gtr_date_start');
$bridge->addDate('gtr_date_until');
if (!$this->createData) {
$bridge->addCheckbox('gtr_active');
}
if ($model->has('gtr_code')) {
$bridge->addText('gtr_code');
}
if ($model->has('gtr_calculation_event', 'label')) {
$bridge->add('gtr_calculation_event');
}
if ($model->has('gtr_completed_event', 'label')) {
$bridge->add('gtr_completed_event');
}
if ($model->has('gtr_beforefieldupdate_event', 'label')) {
$bridge->add('gtr_beforefieldupdate_event');
}
if ($model->has('gtr_fieldupdate_event', 'label')) {
$bridge->add('gtr_fieldupdate_event');
}
$bridge->add('gtr_organizations');
if (\MUtil_Bootstrap::enabled()) {
$element = new \MUtil_Bootstrap_Form_Element_ToggleCheckboxes('toggleOrg', array('selector' => 'input[name^=gtr_organizations]'));
} else {
$element = new \Gems_JQuery_Form_Element_ToggleCheckboxes('toggleOrg', array('selector' => 'input[name^=gtr_organizations]'));
}
$element->setLabel($this->_('Toggle'));
$bridge->addElement($element);
}
示例6: isValid
/**
* Returns true if and only if $value meets the validation requirements
*
* If $value fails validation, then this method returns false, and
* getMessages() will return an array of messages that explain why the
* validation failed.
*
* @param mixed $value
* @param array $context
* @return boolean
* @throws \Zend_Validate_Exception If validation of $value is impossible
*/
public function isValid($value, $context = array())
{
$this->_setValue($value);
// Make sure the (optionally filtered) value is in the context
$context[reset($this->_fields)] = $value;
$filter = array();
foreach ($this->_fields as $name) {
// Return valid when not all the fields to check for are in the context
if (!isset($context[$name])) {
return true;
}
$filter[$name] = $context[$name];
}
$check = array();
$doGet = $this->_model->hasItemsUsed();
$keys = $this->_model->getKeys();
foreach ($keys as $id => $key) {
if ($doGet) {
// Make sure the item is used
$this->_model->get($key);
}
if (isset($context[$id])) {
$check[$key] = $context[$id];
} elseif (isset($context[$key])) {
$check[$key] = $context[$key];
} else {
// Not all keys are in => therefore this is a new item
$check = false;
break;
}
}
$rows = $this->_model->load($filter);
if (!$rows) {
return true;
}
if (!$check) {
// Rows where found while it is a new item
$this->_error(self::ERROR_RECORD_FOUND);
return false;
}
$count = count($check);
foreach ($rows as $row) {
// Check for return of the whole check
if (count(array_intersect_assoc($check, $row)) !== $count) {
// There exists a row with the same values but not the same keys
$this->_error(self::ERROR_RECORD_FOUND);
return false;
}
}
return true;
}
示例7: saveValue
/**
* A ModelAbstract->setOnSave() function that tracks the change
*
* @see \MUtil_Model_ModelAbstract
*
* @param mixed $value The value being saved
* @param boolean $isNew True when a new item is being saved
* @param string $name The name of the current field
* @param array $context Optional, the other values being saved
* @return string Of the values concatenated
*/
public function saveValue($value, $isNew = false, $name = null, array $context = array())
{
// \MUtil_Echo::track($value, $this->_changedValue);
// Once the value is set (and e.g. stored in the database) do not overwrite it
if ($this->_changedValue == $value) {
return $value;
}
$compare = $this->_model->get($name, __CLASS__);
if (!(is_array($compare) && 2 === count($compare))) {
// Actually a valid setting, do nothring
return $value;
}
list($trackedField, $oldValueField) = $compare;
if (!isset($context[$trackedField], $context[$oldValueField])) {
return $value;
}
if (!($context[$trackedField] && $context[$oldValueField])) {
return $context[$trackedField] || $context[$oldValueField] ? $this->_changedValue : $this->_unchangedValue;
}
$storageFormat = $this->_model->get($trackedField, 'storageFormat');
if (!$storageFormat) {
return $context[$trackedField] == $context[$oldValueField] ? $this->_unchangedValue : $this->_changedValue;
}
if ($context[$oldValueField] instanceof \Zend_Date) {
$oldValue = $context[$oldValueField];
} else {
$oldValue = new \MUtil_Date($context[$oldValueField], $storageFormat);
}
if ($context[$trackedField] instanceof \Zend_Date) {
$currentValue = $context[$trackedField];
} elseif (\Zend_Date::isDate($context[$trackedField], $storageFormat)) {
$currentValue = new \MUtil_Date($context[$trackedField], $storageFormat);
} else {
if ($this->_model->has($trackedField, 'dateFormat')) {
$secondFormat = $this->_model->get($trackedField, 'dateFormat');
} else {
$secondFormat = \MUtil_Model_Bridge_FormBridge::getFixedOption('date', 'dateFormat');
}
if (!\Zend_Date::isDate($context[$trackedField], $secondFormat)) {
// Cannot compare, do nothing
return $value;
}
$currentValue = new \MUtil_Date($context[$trackedField], $secondFormat);
}
// \MUtil_Echo::track($trackedField, $oldValueField, $oldValue->toString(), $currentValue->toString(), $oldValue->getTimestamp() === $currentValue->getTimestamp());
return $oldValue->getTimestamp() === $currentValue->getTimestamp() ? $this->_unchangedValue : $this->_changedValue;
}
示例8: addBrowseTableColumns
/**
* Adds columns from the model to the bridge that creates the browse table.
*
* Overrule this function to add different columns to the browse table, without
* having to recode the core table building code.
*
* @param \MUtil_Model_Bridge_TableBridge $bridge
* @param \MUtil_Model_ModelAbstract $model
* @return void
*/
protected function addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
{
// Add link to patient to overview
$menuItems = $this->findMenuItems('respondent', 'show');
if ($menuItems) {
$menuItem = reset($menuItems);
if ($menuItem instanceof \Gems_Menu_SubMenuItem) {
$href = $menuItem->toHRefAttribute($bridge);
if ($href) {
$aElem = new \MUtil_Html_AElement($href);
$aElem->setOnEmpty('');
// Make sure org is known
$model->get('gr2o_id_organization');
$model->set('gr2o_patient_nr', 'itemDisplay', $aElem);
$model->set('respondent_name', 'itemDisplay', $aElem);
}
}
}
$model->set('gto_id_token', 'formatFunction', 'strtoupper');
$bridge->setDefaultRowClass(\MUtil_Html_TableElement::createAlternateRowClass('even', 'even', 'odd', 'odd'));
$tr1 = $bridge->tr();
$tr1->appendAttrib('class', $bridge->row_class);
$tr1->appendAttrib('title', $bridge->gto_comment);
$bridge->addColumn($this->createShowTokenButton($bridge), ' ')->rowspan = 2;
// Space needed because TableElement does not look at rowspans
$bridge->addSortable('gto_valid_from');
$bridge->addSortable('gto_valid_until');
$bridge->addSortable('gto_id_token');
// $bridge->addSortable('gto_mail_sent_num', $this->_('Contact moments'))->rowspan = 2;
$this->addRespondentCell($bridge, $model);
$bridge->addMultiSort('ggp_name', array($this->createActionButtons($bridge)));
$tr2 = $bridge->tr();
$tr2->appendAttrib('class', $bridge->row_class);
$tr2->appendAttrib('title', $bridge->gto_comment);
$bridge->addSortable('gto_mail_sent_date');
$bridge->addSortable('gto_completion_time');
$bridge->addSortable('gto_mail_sent_num', $this->_('Contact moments'));
if ($this->multiTracks) {
$model->set('gr2t_track_info', 'tableDisplay', 'smallData');
$model->set('gto_round_description', 'tableDisplay', 'smallData');
$bridge->addMultiSort('gtr_track_name', 'gr2t_track_info', array($bridge->gtr_track_name->if(\MUtil_Html::raw(' » ')), ' '), 'gsu_survey_name', 'gto_round_description');
} else {
$bridge->addMultiSort('gto_round_description', \MUtil_Html::raw('; '), 'gsu_survey_name');
}
$bridge->addSortable('assigned_by');
}
示例9: addBrowseTableColumns
/**
* Adds columns from the model to the bridge that creates the browse table.
*
* Overrule this function to add different columns to the browse table, without
* having to recode the core table building code.
*
* @param \MUtil_Model_Bridge_TableBridge $bridge
* @param \MUtil_Model_ModelAbstract $model
* @return void
*/
protected function addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
{
// $bridge->getTable()->setAlternateRowClass('odd', 'odd', 'even', 'even');
// \MUtil_Model::$verbose = true;
$bridge->add('gro_round_description', $bridge->createSortLink('gro_id_order', $model->get('gro_round_description', 'label')));
$bridge->addSortable('gsu_survey_name');
$bridge->th(array($bridge->createSortLink('answered'), 'colspan' => 2))->class = 'centerAlign';
$bridge->td($bridge->answered)->class = 'centerAlign';
$bridge->td($this->percentageLazy($bridge->answered, $bridge->total))->class = 'rightAlign';
$bridge->th(array($bridge->createSortLink('missed'), 'colspan' => 2))->class = 'centerAlign';
$bridge->td($bridge->missed)->class = 'centerAlign';
$bridge->td($this->percentageLazy($bridge->missed, $bridge->total))->class = 'rightAlign';
$bridge->th(array($bridge->createSortLink('open'), 'colspan' => 2))->class = 'centerAlign';
$bridge->td($bridge->open)->class = 'centerAlign';
$bridge->td($this->percentageLazy($bridge->open, $bridge->total))->class = 'rightAlign';
// $bridge->addSortable('answered');
// $bridge->addSortable('missed');
// $bridge->addSortable('open');
// $bridge->add('future');
// $bridge->add('unknown');
$bridge->addColumn(array('=', 'class' => 'centerAlign'));
$bridge->addSortable('total');
$bridge->addSortable('gsu_id_primary_group');
// $bridge->tr();
// $bridge->add('gsu_survey_name')->colspan = 4;
// $bridge->add('gsu_id_primary_group')->colspan = 2;
// $bridge->addColumn();
/*
$bridge->addColumn(
array(
$bridge->gsu_survey_name,
\MUtil_Html::create('em', ' - ', $bridge->gsu_id_primary_group)
),
array(
$model->get('gsu_survey_name', 'label'),
\MUtil_Html::create('em', ' - ', $model->get('gsu_id_primary_group', 'label'))
)
)->colspan = 7;
$bridge->add('removed');
// */
}
示例10: checkPicker
/**
* Checks and updates the on and off strings when one of the effecteds is a date, time or datetime field
*
* @param string $valueOn
* @param string $valueOff
*/
protected function checkPicker(&$valueOn, &$valueOff)
{
$effecteds = array_keys($this->getEffecteds());
foreach ($effecteds as $field) {
if ($this->model instanceof \MUtil_Model_ModelAbstract && $this->model->has($field)) {
$modelItemType = $this->model->get($field, 'type');
$dateFormat = $this->model->get($field, 'dateFormat');
$timeFormat = $this->model->get($field, 'timeFormat');
switch ($modelItemType) {
case \MUtil_Model::TYPE_DATE:
case \MUtil_Model::TYPE_TIME:
case \MUtil_Model::TYPE_DATETIME:
$picker = 'datepicker';
break;
default:
$picker = '';
break;
}
if (!empty($picker)) {
// If none set, get the locale default dateformat
if (!$dateFormat && !$timeFormat && \Zend_Registry::isRegistered('Zend_Locale')) {
$dateFormat = \ZendX_JQuery_View_Helper_DatePicker::resolveZendLocaleToDatePickerFormat();
}
if ($dateFormat) {
if ($timeFormat) {
$picker = 'datetimepicker';
}
} elseif ($timeFormat) {
$picker = 'timepicker';
}
$valueOn .= "\$('#{$field}').{$picker}('enable');";
$valueOff .= "\$('#{$field}').{$picker}('disable');";
}
}
}
}
示例11: filterBasic
/**
* Translate textual null values to actual PHP nulls and trim any whitespace
*
* @param mixed $value
* @param scalar $key The array key, optionally a model key as well
* @return mixed
*/
public function filterBasic(&$value, $key)
{
if (is_string($value) && $this->nullValue === strtoupper($value)) {
$value = null;
return;
}
if ($this->_targetModel instanceof \MUtil_Model_ModelAbstract) {
if ($this->_targetModel->is($key, 'type', \MUtil_Model::TYPE_DATE)) {
$format = $this->dateFormat;
} elseif ($this->_targetModel->is($key, 'type', \MUtil_Model::TYPE_DATETIME)) {
$format = $this->datetimeFormat;
} elseif ($this->_targetModel->is($key, 'type', \MUtil_Model::TYPE_TIME)) {
$format = $this->timeFormat;
} else {
$format = false;
}
if ($this->dateLocale && is_string($this->dateLocale)) {
$this->dateLocale = new \Zend_Locale($this->dateLocale);
}
if ($format && \Zend_Date::isDate($value, $format, $this->dateLocale)) {
$value = new \MUtil_Date($value, $format, $this->dateLocale);
return;
}
$options = $this->_targetModel->get($key, 'multiOptions');
if ($options && !isset($options[$value]) && in_array($value, $options)) {
$value = array_search($value, $options);
}
}
if (is_string($value)) {
$value = trim($value);
return;
}
return;
}
示例12: addFormElements
/**
* Adds elements from the model to the bridge that creates the form.
*
* Overrule this function to add different elements to the browse table, without
* having to recode the core table building code.
*
* @param \MUtil_Model_Bridge_FormBridgeInterface $bridge
* @param \MUtil_Model_ModelAbstract $model
*/
protected function addFormElements(\MUtil_Model_Bridge_FormBridgeInterface $bridge, \MUtil_Model_ModelAbstract $model)
{
$bridge->addHtml('to', 'label', $this->_('To'));
$bridge->addHtml('prefered_language', 'label', $this->_('Prefered Language'));
$bridge->addElement($this->mailElements->createTemplateSelectElement('select_template', $this->_('Template'), $this->mailTarget, $this->templateOnly, true));
if ($this->templateOnly) {
$bridge->addHidden('subject');
} else {
$bridge->addText('subject', 'label', $this->_('Subject'), 'size', 50);
}
$mailBody = $bridge->addElement($this->mailElements->createBodyElement('mailBody', $this->_('Message'), $model->get('gctt_body', 'required'), $this->templateOnly));
if ($mailBody instanceof \Gems_Form_Element_CKEditor) {
$mailBody->config['availablefields'] = $this->mailer->getMailFields();
$mailBody->config['availablefieldsLabel'] = $this->_('Fields');
$mailBody->config['extraPlugins'] .= ',availablefields';
$mailBody->config['toolbar'][] = array('availablefields');
}
if (!$this->templateOnly) {
$bridge->addFakeSubmit('preview', array('label' => $this->_('Preview')));
}
$bridge->addElement($this->createFromSelect('from', $this->_('From')));
$bridge->addElement($this->mailElements->createSubmitButton('send', $this->_('Send')));
$bridge->addElement($this->mailElements->createPreviewHtmlElement('Preview HTML'));
$bridge->addElement($this->mailElements->createPreviewTextElement('Preview Text'));
if (!$this->templateOnly) {
$bridge->addHtml('available_fields', array('label' => $this->_('Available fields')));
}
}
示例13: replaceCreateView
/**
* Handles creating or replacing the view for this survey
*
* @param \Gems_Tracker_Survey $viewName
* @param \MUtil_Model_ModelAbstract $answerModel
*/
protected function replaceCreateView(\Gems_Tracker_Survey $survey, \MUtil_Model_ModelAbstract $answerModel)
{
$viewName = $this->getViewName($survey);
$responseDb = $this->project->getResponseDatabase();
$fieldSql = '';
foreach ($answerModel->getItemsOrdered() as $name) {
if (true === $answerModel->get($name, 'survey_question') && !in_array($name, array('submitdate', 'startdate', 'datestamp')) && !$answerModel->is($name, 'type', \MUtil_Model::TYPE_NOVALUE)) {
// Only real answers
$fieldSql .= ',MAX(IF(gdr_answer_id = ' . $responseDb->quote($name) . ', gdr_response, NULL)) AS ' . $responseDb->quoteIdentifier($name);
}
}
if ($fieldSql > '') {
$dbConfig = $this->db->getConfig();
$tokenTable = $this->db->quoteIdentifier($dbConfig['dbname'] . '.gems__tokens');
$createViewSql = 'CREATE OR REPLACE VIEW ' . $responseDb->quoteIdentifier($viewName) . ' AS SELECT gdr_id_token';
$createViewSql .= $fieldSql;
$createViewSql .= "FROM gemsdata__responses join " . $tokenTable . " on (gto_id_token=gdr_id_token and gto_id_survey=" . $survey->getSurveyId() . ") GROUP BY gdr_id_token;";
try {
$responseDb->query($createViewSql)->execute();
} catch (Exception $exc) {
$responseConfig = $responseDb->getConfig();
$dbUser = $this->db->quoteIdentifier($responseConfig['username']) . '@' . $this->db->quoteIdentifier($responseConfig['host']);
$statement = "GRANT SELECT ON " . $tokenTable . " TO " . $dbUser;
$this->getBatch()->addMessage(sprintf($this->_("Creating view failed, try adding rights using the following statement: %s"), $statement));
}
}
}
示例14: addBrowseTableColumns
/**
* Adds columns from the model to the bridge that creates the browse table.
*
* Overrule this function to add different columns to the browse table, without
* having to recode the core table building code.
*
* @param \MUtil_Model_Bridge_TableBridge $bridge
* @param \MUtil_Model_ModelAbstract $model
* @return void
*/
protected function addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
{
$bridge->gr2o_patient_nr;
$bridge->gr2o_id_organization;
if ($menuItem = $this->menu->find(array('controller' => 'appointment', 'action' => 'show', 'allowed' => true))) {
$appButton = $menuItem->toActionLink($this->request, $bridge, $this->_('Show appointment'));
} else {
$appButton = null;
}
if ($menuItem = $this->menu->find(array('controller' => 'appointment', 'action' => 'edit', 'allowed' => true))) {
$editButton = $menuItem->toActionLink($this->request, $bridge, $this->_('Edit appointment'));
} else {
$editButton = null;
}
$br = \MUtil_Html::create('br');
$table = $bridge->getTable();
$table->appendAttrib('class', 'calendar');
$bridge->tr()->appendAttrib('class', $bridge->row_class);
if ($appButton) {
$bridge->addItemLink($appButton)->class = 'middleAlign';
}
if ($this->sortableLinks) {
$bridge->addMultiSort(array($bridge->date_only), $br, 'gap_admission_time')->class = 'date';
$bridge->addMultiSort('gap_subject', $br, 'glo_name');
$bridge->addMultiSort('gaa_name', $br, 'gapr_name');
$bridge->addMultiSort('gor_name', $br, 'glo_name');
} else {
$bridge->addMultiSort(array($bridge->date_only), $br, array($bridge->gap_admission_time, $model->get('gap_admission_time', 'label')));
$bridge->addMultiSort(array($bridge->gap_subject, $model->get('gap_subject', 'label')), $br, array($bridge->gas_name, $model->get('gas_name', 'label')));
$bridge->addMultiSort(array($bridge->gaa_name, $model->get('gaa_name', 'label')), $br, array($bridge->gapr_name, $model->get('gapr_name', 'label')));
$bridge->addMultiSort(array($bridge->gor_name, $model->get('gor_name', 'label')), $br, array($bridge->glo_name, $model->get('glo_name', 'label')));
}
if ($editButton) {
$bridge->addItemLink($editButton)->class = 'middleAlign rightAlign';
}
}
示例15: addUnionModel
/**
* Add an extra model to the union
*
* @param \MUtil_Model_ModelAbstract $model
* @param array $fieldMap Map from the sub model field names to this models names
* @param string $name
* @return \MUtil_Model_UnionModelAbstract (continuation pattern)
*/
public function addUnionModel(\MUtil_Model_ModelAbstract $model, array $fieldMap = null, $name = null)
{
if (null === $name) {
$name = $model->getName();
}
$this->_unionModels[$name] = $model;
if ($fieldMap) {
$this->_unionMapsFrom[$name] = $fieldMap;
$this->_unionMapsTo[$name] = array_flip($fieldMap);
} else {
$this->_unionMapsFrom[$name] = false;
$this->_unionMapsTo[$name] = false;
$fieldMap = array();
}
foreach ($model->getItemsOrdered() as $subName) {
if (isset($fieldMap[$subName])) {
$mainName = $fieldMap[$subName];
} else {
$mainName = $subName;
}
$this->set($mainName, $model->get($subName));
}
return $this;
}