当前位置: 首页>>代码示例>>PHP>>正文


PHP MUtil_Html类代码示例

本文整理汇总了PHP中MUtil_Html的典型用法代码示例。如果您正苦于以下问题:PHP MUtil_Html类的具体用法?PHP MUtil_Html怎么用?PHP MUtil_Html使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MUtil_Html类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addBrowseTableColumns

 /**
  * Adds columns from the model to the bridge that creates the browse table.
  *
  * Adds a button column to the model, if such a button exists in the model.
  *
  * @param \MUtil_Model_Bridge_TableBridge $bridge
  * @param \MUtil_Model_ModelAbstract $model
  * @rturn void
  */
 protected function addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
 {
     $model->setIfExists('gr2o_opened', 'tableDisplay', 'small');
     $model->setIfExists('grs_email', 'formatFunction', array('MUtil_Html_AElement', 'ifmail'));
     if ($menuItem = $this->findAllowedMenuItem('show')) {
         $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge));
     }
     // Newline placeholder
     $br = \MUtil_Html::create('br');
     // Display separator and phone sign only if phone exist.
     $phonesep = $bridge->itemIf($bridge->grs_phone_1, \MUtil_Html::raw('☏ '));
     $citysep = $bridge->itemIf($bridge->grs_zipcode, \MUtil_Html::raw('  '));
     if ($this->currentUser->hasPrivilege('pr.respondent.multiorg')) {
         $bridge->addMultiSort('gr2o_patient_nr', $br, 'gor_name');
         //, \MUtil_Html::raw(' '), 'gr2o_opened');
     } else {
         $bridge->addMultiSort('gr2o_patient_nr', $br, 'gr2o_opened');
     }
     $bridge->addMultiSort('name', $br, 'grs_email');
     $bridge->addMultiSort('grs_address_1', $br, 'grs_zipcode', $citysep, 'grs_city');
     $bridge->addMultiSort('grs_birthday', $br, $phonesep, 'grs_phone_1');
     if ($menuItem = $this->findAllowedMenuItem('edit')) {
         $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge));
     }
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:34,代码来源:RespondentAction.php

示例2: getHtmlOutput

 /**
  * Copied from parent, but insert chart instead of table after commented out part
  *
  * @param \Zend_View_Abstract $view
  * @return type
  */
 public function getHtmlOutput(\Zend_View_Abstract $view)
 {
     $snippets = array();
     $data = $this->getModel()->load();
     // Find the first token with answers
     foreach ($data as $tokenData) {
         $token = $this->loader->getTracker()->getToken($tokenData)->refresh();
         $tokenAnswers = $token->getRawAnswers();
         if (!empty($tokenAnswers)) {
             break;
         }
     }
     // Some spacing with previous elements
     $snippets[] = \MUtil_Html::create()->p(\MUtil_Html::raw(' '), array('style' => 'clear:both;'));
     $config = $this->getConfig($token);
     // Fallback to all score elements in one chart when no config found
     if (!is_array($config)) {
         $config = array();
         foreach ($tokenAnswers as $key => $value) {
             if (substr(strtolower($key), 0, 5) == 'score') {
                 $config[0]['question_code'][] = $key;
             }
         }
     }
     // Set the default options
     $defaultOptions = array('data' => $data, 'showHeaders' => false, 'showButtons' => false);
     // Add all configured charts
     foreach ($config as $chartOptions) {
         $chartOptions = $chartOptions + $defaultOptions;
         $snippets[] = $this->loader->getSnippetLoader($this)->getSnippet('Survey_Display_BarChartSnippet', $chartOptions);
     }
     // Clear the floats
     $snippets[] = \MUtil_Html::create()->p(array('class' => 'chartfooter'));
     return $snippets;
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:41,代码来源:ScoreChartsSnippet.php

示例3: testDiv

 public function testDiv()
 {
     $div = MUtil_Html::div('bar', array('id' => 'foo'));
     $this->assertInstanceOf('MUtil_Html_HtmlElement', $div);
     $this->assertEquals('div', $div->getTagName());
     $this->assertEquals('foo', $div->getAttrib('id'));
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:7,代码来源:HtmlTest.php

示例4: render

 public function render(\Zend_View_Abstract $view)
 {
     // \MUtil_Echo::r(sprintf('Rendering snippet %s.', get_class($this)));
     //
     // TODO: Change snippet workings.
     // All forms are processed twice if hasHtmlOutput() is called here. This is
     // a problem when downloading files.
     // However: not being able to call hasHtmlOutput() twice is not part of the original plan
     // so I gotta rework the forms. :(
     //
     if (!$this->hasHtmlOutput() && $this->getRedirectRoute()) {
         $this->redirectRoute();
     } else {
         $html = $this->getHtmlOutput($view);
         if ($html) {
             if ($html instanceof \MUtil_Html_HtmlInterface) {
                 if ($html instanceof \MUtil_Html_HtmlElement) {
                     $this->applyHtmlAttributes($html);
                 }
                 return $html->render($view);
             } else {
                 return \MUtil_Html::renderAny($view, $html);
             }
         }
     }
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:26,代码来源:YesNoDeleteSnippet.php

示例5: createModel

 /**
  * Creates a model for getModel(). Called only for each new $action.
  *
  * The parameters allow you to easily adapt the model to the current action. The $detailed
  * parameter was added, because the most common use of action is a split between detailed
  * and summarized actions.
  *
  * @param boolean $detailed True when the current action is not in $summarizedActions.
  * @param string $action The current action.
  * @return \MUtil_Model_ModelAbstract
  */
 public function createModel($detailed, $action)
 {
     $rcLib = $this->util->getReceptionCodeLibrary();
     $yesNo = $this->util->getTranslated()->getYesNo();
     $model = new \MUtil_Model_TableModel('gems__reception_codes');
     $model->copyKeys();
     // The user can edit the keys.
     $model->set('grc_id_reception_code', 'label', $this->_('Code'), 'size', '10');
     $model->set('grc_description', 'label', $this->_('Description'), 'size', '30');
     $model->set('grc_success', 'label', $this->_('Is success code'), 'multiOptions', $yesNo, 'elementClass', 'CheckBox', 'description', $this->_('This reception code is a success code.'));
     $model->set('grc_active', 'label', $this->_('Active'), 'multiOptions', $yesNo, 'elementClass', 'CheckBox', 'description', $this->_('Only active codes can be selected.'));
     if ($detailed) {
         $model->set('desc1', 'elementClass', 'Html', 'label', ' ', 'value', \MUtil_Html::create('h4', $this->_('Can be assigned to')));
     }
     $model->set('grc_for_respondents', 'label', $this->_('Respondents'), 'multiOptions', $yesNo, 'elementClass', 'CheckBox', 'description', $this->_('This reception code can be assigned to a respondent.'));
     $model->set('grc_for_tracks', 'label', $this->_('Tracks'), 'multiOptions', $yesNo, 'elementClass', 'CheckBox', 'description', $this->_('This reception code can be assigned to a track.'));
     $model->set('grc_for_surveys', 'label', $this->_('Tokens'), 'multiOptions', $rcLib->getSurveyApplicationValues(), 'description', $this->_('This reception code can be assigned to a token.'));
     if ($detailed) {
         $model->set('desc2', 'elementClass', 'Html', 'label', ' ', 'value', \MUtil_Html::create('h4', $this->_('Additional actions')));
     }
     $model->set('grc_redo_survey', 'label', $this->_('Redo survey'), 'multiOptions', $rcLib->getRedoValues(), 'description', $this->_('Redo a survey on this reception code.'));
     $model->set('grc_overwrite_answers', 'label', $this->_('Overwrite existing consents'), 'multiOptions', $yesNo, 'elementClass', 'CheckBox', 'description', $this->_('Remove the consent from already answered surveys.'));
     if ($detailed) {
         $model->set('grc_id_reception_code', 'validator', $model->createUniqueValidator('grc_id_reception_code'));
         $model->set('grc_description', 'validator', $model->createUniqueValidator('grc_description'));
     }
     if ($this->project->multiLocale) {
         $model->set('grc_description', 'description', 'ENGLISH please! Use translation file to translate.');
     }
     \Gems_Model::setChangeFieldsByPrefix($model, 'grc');
     return $model;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:43,代码来源:ReceptionAction.php

示例6: getHtmlOutput

 /**
  * Create the snippets content
  *
  * This is a stub function either override getHtmlOutput() or override render()
  *
  * @param \Zend_View_Abstract $view Just in case it is needed here
  * @return \MUtil_Html_HtmlInterface Something that can be rendered
  */
 public function getHtmlOutput(\Zend_View_Abstract $view)
 {
     $url = $view->url(array('action' => 'export'));
     $container = \MUtil_Html::div(array('id' => 'export-container'));
     $button = $container->button(array($this->_('Export'), 'id' => 'modelExport'));
     return $container;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:15,代码来源:ExportSnippet.php

示例7: 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
  */
 public function addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
 {
     $model->set('gr2o_patient_nr', 'label', $this->_('Respondent'));
     $model->set('gto_round_description', 'label', $this->_('Round / Details'));
     $model->set('gto_valid_from', 'label', $this->_('Valid from'));
     $model->set('gto_valid_until', 'label', $this->_('Valid until'));
     $model->set('gto_mail_sent_date', 'label', $this->_('Contact date'));
     $model->set('respondent_name', 'label', $this->_('Name'));
     $HTML = \MUtil_Html::create();
     $bridge->setDefaultRowClass(\MUtil_Html_TableElement::createAlternateRowClass('even', 'even', 'odd', 'odd'));
     $bridge->addColumn($this->getTokenLinks($bridge), ' ')->rowspan = 2;
     // Space needed because TableElement does not look at rowspans
     $bridge->addSortable('gto_valid_from');
     $bridge->addSortable('gto_valid_until');
     $bridge->addMultiSort('gr2o_patient_nr', $HTML->raw('; '), 'respondent_name');
     $bridge->addMultiSort('ggp_name', array($this->getActionLinks($bridge)));
     $bridge->tr();
     $bridge->addSortable('gto_mail_sent_date');
     $bridge->addSortable('gto_completion_time');
     if ($this->escort instanceof \Gems_Project_Tracks_SingleTrackInterface) {
         $bridge->addMultiSort('gto_round_description', $HTML->raw('; '), 'gsu_survey_name');
     } else {
         $model->set('gr2t_track_info', 'tableDisplay', 'smallData');
         $model->set('gto_round_description', 'tableDisplay', 'smallData');
         $bridge->addMultiSort('gtr_track_name', 'gr2t_track_info', $bridge->gtr_track_name->if($HTML->raw(' » ')), 'gsu_survey_name', 'gto_round_description');
     }
     $bridge->addSortable('assigned_by');
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:38,代码来源:TokenPlanTableSnippet.php

示例8: addTableCells

 /**
  * Place to set the data to display
  *
  * @param \MUtil_Model_Bridge_VerticalTableBridge $bridge
  * @return void
  */
 protected function addTableCells(\MUtil_Model_Bridge_VerticalTableBridge $bridge)
 {
     $HTML = \MUtil_Html::create();
     $bridge->caption($this->getCaption());
     $br = $HTML->br();
     $address[] = $bridge->grs_address_1;
     $address[] = $br;
     if ($this->model->has('grs_address_2')) {
         $address[] = $bridge->grs_address_2;
         $address[] = $bridge->itemIf('grs_address_2', $br);
     }
     $address[] = $bridge->grs_zipcode;
     $address[] = $bridge->itemIf('grs_zipcode', new \MUtil_Html_Raw('  '));
     $address[] = $bridge->grs_city;
     // ROW 0
     $label = $this->model->get('gr2o_patient_nr', 'label');
     // Try to read label from model...
     if (empty($label)) {
         $label = $this->_('Respondent nr: ');
         // ...but have a fall-back
     }
     $bridge->addItem($bridge->gr2o_patient_nr, $label);
     $bridge->addItem($HTML->spaced($bridge->itemIf('grs_last_name', array($bridge->grs_last_name, ',')), $bridge->grs_gender, $bridge->grs_first_name, $bridge->grs_surname_prefix), $this->_('Respondent'));
     // ROW 1
     $bridge->addItem('grs_birthday');
     $bridge->addItem('grs_phone_1');
     // ROW 2
     $bridge->addItem('grs_email');
     $bridge->addItem($address, $this->_('Address'));
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:36,代码来源:RespondentDetailsSnippet.php

示例9: getAutoSearchElements

 /**
  * Returns a text element for autosearch. Can be overruled.
  *
  * The form / html elements to search on. Elements can be grouped by inserting null's between them.
  * That creates a distinct group of elements
  *
  * @param array $data The $form field values (can be usefull, but no need to set them)
  * @return array Of \Zend_Form_Element's or static tekst to add to the html or null for group breaks.
  */
 protected function getAutoSearchElements(array $data)
 {
     $elements = parent::getAutoSearchElements($data);
     if ($elements) {
         $elements[] = null;
         // break into separate spans
     }
     if ($this->periodSelector) {
         $dates = array('_gto_valid_from gto_valid_until' => $this->_('Is valid during'), '-gto_valid_from gto_valid_until' => $this->_('Is valid within'), 'gto_valid_from' => $this->_('Valid from'), 'gto_valid_until' => $this->_('Valid until'), 'gto_mail_sent_date' => $this->_('E-Mailed on'), 'gto_completion_time' => $this->_('Completion date'));
         $this->_addPeriodSelectors($elements, $dates);
         $elements[] = null;
         // break into separate spans
     }
     $allowedOrgs = $this->getOrganizationList($data);
     $orgWhere = "(INSTR(gtr_organizations, '|" . implode("|') > 0 OR INSTR(gtr_organizations, '|", array_keys($allowedOrgs)) . "|') > 0)";
     $elements[] = $this->_('Select:');
     $elements[] = \MUtil_Html::create('br');
     // Add track selection
     if ($this->multiTracks) {
         $elements[] = $this->_createSelectElement('gto_id_track', $this->getAllTrackTypes($orgWhere, $data), $this->_('(all tracks)'));
     }
     $elements[] = $this->_createSelectElement('gto_round_description', $this->getAllTrackRounds($orgWhere, $data), $this->_('(all rounds)'));
     $elements[] = $this->_createSelectElement('gto_id_survey', $this->getAllSurveys($orgWhere, $data), $this->_('(all surveys)'));
     $options = array('all' => $this->_('(all actions)'), 'open' => $this->_('Open'), 'notmailed' => $this->_('Not emailed'), 'tomail' => $this->_('To email'), 'toremind' => $this->_('Needs reminder'), 'hasnomail' => $this->_('Missing email'), 'toanswer' => $this->_('Yet to Answer'), 'answered' => $this->_('Answered'), 'missed' => $this->_('Missed'), 'removed' => $this->_('Removed'));
     $elements[] = $this->_createSelectElement('main_filter', $options);
     $elements[] = $this->_createSelectElement('gsu_id_primary_group', $this->getAllGroups($orgWhere, $data), $this->_('(all fillers)'));
     // Select organisation
     if (count($allowedOrgs) > 1) {
         $elements[] = $this->_createSelectElement('gto_id_organization', $allowedOrgs, $this->_('(all organizations)'));
     }
     $elements[] = $this->_createSelectElement('gr2t_created_by', $this->getAllCreators($allowedOrgs, $data), $this->_('(all staff)'));
     return $elements;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:42,代码来源:PlanSearchSnippet.php

示例10: getHtmlOutput

 public function getHtmlOutput(\Zend_View_Abstract $view)
 {
     parent::getHtmlOutput($view);
     $respondentModel = $this->model;
     $respondentData = $this->data;
     $respondentId = $this->respondentId;
     $html = $this->getHtmlSequence();
     if (empty($this->data)) {
         $html->p()->b(sprintf($this->_('Unknown respondent %s'), $respondentId));
         return $html;
     }
     $bridge = $respondentModel->getBridgeFor('itemTable', array('class' => 'browser table'));
     $bridge->setRepeater(\MUtil_Lazy::repeat(array($respondentData)));
     $bridge->th($this->_('Respondent information'), array('colspan' => 4));
     $bridge->setColumnCount(2);
     foreach ($respondentModel->getItemsOrdered() as $name) {
         if ($label = $respondentModel->get($name, 'label')) {
             $bridge->addItem($name, $label);
         }
     }
     $tableContainer = \MUtil_Html::create()->div(array('class' => 'table-container'));
     $tableContainer[] = $bridge->getTable();
     $html->h2($this->_('Respondent information') . ': ' . $respondentId);
     $html[] = $tableContainer;
     $html->hr();
     return $html;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:27,代码来源:RespondentSnippet.php

示例11: getAutoSearchElements

 /**
  * Returns a text element for autosearch. Can be overruled.
  *
  * The form / html elements to search on. Elements can be grouped by inserting null's between them.
  * That creates a distinct group of elements
  *
  * @param array $data The $form field values (can be usefull, but no need to set them)
  * @return array Of \Zend_Form_Element's or static tekst to add to the html or null for group breaks.
  */
 protected function getAutoSearchElements(array $data)
 {
     $elements = parent::getAutoSearchElements($data);
     $user = $this->loader->getCurrentUser();
     if ($user->hasPrivilege('pr.respondent.select-on-track')) {
         $tracks = $this->searchData['__active_tracks'];
         $masks['show_all'] = $this->_('(all)');
         $masks['show_without_track'] = $this->_('(no track)');
         if (count($tracks) > 1) {
             $masks['show_with_track'] = $this->_('(with track)');
         }
         if (count($tracks) > 1) {
             $elements[] = $this->_createSelectElement('gr2t_id_track', $masks + $tracks);
         } else {
             $element = $this->_createRadioElement('gr2t_id_track', $masks + $tracks);
             $element->setSeparator(' ');
             $elements[] = $element;
         }
         $lineBreak = true;
     } else {
         $lineBreak = false;
     }
     if ($user->hasPrivilege('pr.respondent.show-deleted')) {
         $elements[] = $this->_createCheckboxElement('grc_success', $this->_('Show active'));
     }
     if ($this->model->isMultiOrganization()) {
         $element = $this->_createSelectElement(\MUtil_Model::REQUEST_ID2, $user->getRespondentOrganizations(), $this->_('(all organizations)'));
         if ($lineBreak) {
             $element->setLabel($this->_('Organization'))->setAttrib('onchange', 'this.form.submit();');
             $elements[] = \MUtil_Html::create('br');
         }
         $elements[] = $element;
     }
     return $elements;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:44,代码来源:RespondentSearchSnippet.php

示例12: getAutoSearchElements

 /**
  * Returns a text element for autosearch. Can be overruled.
  *
  * The form / html elements to search on. Elements can be grouped by inserting null's between them.
  * That creates a distinct group of elements
  *
  * @param array $data The $form field values (can be usefull, but no need to set them)
  * @return array Of \Zend_Form_Element's or static tekst to add to the html or null for group breaks.
  */
 protected function getAutoSearchElements(array $data)
 {
     $elements = parent::getAutoSearchElements($data);
     $elements[] = new \Zend_Form_Element_Hidden(\MUtil_Model::REQUEST_ID);
     $elements[] = $this->_createSelectElement('gtf_field_type', $this->model, $this->_('(all types)'));
     $elements[] = \MUtil_Html::create('br');
     return $elements;
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:17,代码来源:FieldsAutosearchForm.php

示例13: _showTable

 protected function _showTable($caption, $data, $nested = false)
 {
     $tableContainer = \MUtil_Html::create()->div(array('class' => 'table-container'));
     $table = \MUtil_Html_TableElement::createArray($data, $caption, $nested);
     $table->class = 'browser table';
     $tableContainer[] = $table;
     $this->html[] = $tableContainer;
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:8,代码来源:ProjectInformationAction.php

示例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->gr2t_id_respondent_track;
     // Data needed for edit button
     $bridge->gr2o_id_organization;
     // Data needed for edit button
     $HTML = \MUtil_Html::create();
     // Get the buttons
     $respMenu = $this->menu->findAllowedController('respondent', 'show');
     if ($respMenu) {
         $respondentButton = $respMenu->toActionLink($this->request, $bridge, $this->_('Show respondent'));
         $respondentButton->appendAttrib('class', 'rightFloat');
     } else {
         $respondentButton = null;
     }
     $trackMenu = $this->menu->findAllowedController('respondent', 'show-track');
     if ($trackMenu) {
         $trackButton = $trackMenu->toActionLink($this->request, $bridge, $this->_('Show track'));
         $trackButton->appendAttrib('class', 'rightFloat');
     } else {
         $trackButton = null;
     }
     // Row with dates and patient data
     $bridge->tr(array('onlyWhenChanged' => true, 'class' => 'even'));
     $bridge->addSortable('gr2o_patient_nr');
     $bridge->addSortable('respondent_name')->colspan = 2;
     if ($this->multiTracks) {
         $bridge->addSortable('grs_birthday');
         $bridge->addMultiSort('grs_city', array($respondentButton));
         $model->set('gr2t_track_info', 'tableDisplay', 'smallData');
         // Row with track info
         $bridge->tr(array('onlyWhenChanged' => true, 'class' => 'even'));
         $td = $bridge->addMultiSort('gtr_track_name', 'gr2t_track_info');
         $td->class = 'indentLeft';
         $td->colspan = 4;
         $td->renderWithoutContent = false;
         // Do not display this cell and thus this row if there is not content
         $td = $bridge->addMultiSort('progress', array($trackButton));
         $td->renderWithoutContent = false;
         // Do not display this cell and thus this row if there is not content
     } else {
         $bridge->addSortable('grs_birthday');
         $bridge->addMultiSort('progress', array($respondentButton));
     }
     $bridge->tr(array('class' => array('odd', $bridge->row_class), 'title' => $bridge->gto_comment));
     $bridge->addColumn($this->createShowTokenButton($bridge))->class = 'rightAlign';
     $bridge->addSortable('gto_valid_from');
     $bridge->addSortable('gto_valid_until');
     $model->set('gto_round_description', 'tableDisplay', 'smallData');
     $bridge->addMultiSort('gsu_survey_name', 'gto_round_description')->colspan = 2;
     $bridge->tr(array('class' => array('odd', $bridge->row_class), 'title' => $bridge->gto_comment));
     $bridge->addColumn();
     $bridge->addSortable('gto_mail_sent_date');
     $bridge->addSortable('gto_completion_time');
     $bridge->addSortable('gto_id_token');
     $bridge->addMultiSort('ggp_name', array($this->createActionButtons($bridge)));
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:67,代码来源:PlanRespondentSnippet.php

示例15: addTableCells

 /**
  * Place to set the data to display
  *
  * @param \MUtil_Model_Bridge_VerticalTableBridge $bridge
  * @return void
  */
 protected function addTableCells(\MUtil_Model_Bridge_VerticalTableBridge $bridge)
 {
     $bridge->setColumnCount(1);
     $HTML = \MUtil_Html::create();
     $bridge->tdh($this->getCaption(), array('colspan' => 2));
     // Caption for tracks
     $trackLabel = $this->_('Assigned tracks');
     if ($menuItem = $this->findMenuItem('track', 'index')) {
         $href = $menuItem->toHRefAttribute($this->request, $bridge);
         $bridge->tdh(array('class' => 'linked'))->a($href, $trackLabel);
     } else {
         $bridge->tdh($trackLabel, array('class' => 'linked'));
     }
     $bridge->tr();
     // ROW 1
     $bridge->addItem($bridge->gr2o_patient_nr, $this->_('Respondent nr: '));
     $rowspan = 10;
     // Column for tracks
     $tracksModel = $this->model->getRespondentTracksModel();
     $tracksData = \MUtil_Lazy::repeat($tracksModel->load(array('gr2o_patient_nr' => $this->repeater->gr2o_patient_nr, 'gr2o_id_organization' => $this->repeater->gr2o_id_organization), array('gr2t_created' => SORT_DESC)));
     $tracksList = $HTML->div($tracksData, array('class' => 'tracksList'));
     $tracksList->setOnEmpty($this->_('No tracks'));
     if ($menuItem = $this->findMenuItem('track', 'show-track')) {
         $href = $menuItem->toHRefAttribute($tracksData, array('gr2o_patient_nr' => $this->repeater->gr2o_patient_nr));
         $tracksTarget = $tracksList->p()->a($href);
     } else {
         $tracksTarget = $tracksList->p();
     }
     $tracksTarget->strong($tracksData->gtr_track_name);
     $tracksTarget[] = ' ';
     $tracksTarget->em($tracksData->gr2t_track_info, array('renderWithoutContent' => false));
     $tracksTarget[] = ' ';
     $tracksTarget[] = \MUtil_Lazy::call($this->util->getTranslated()->formatDate, $tracksData->gr2t_created);
     $bridge->td($tracksList, array('rowspan' => $rowspan, 'class' => 'linked tracksList'));
     // OTHER ROWS
     $bridge->addItem($HTML->spaced($bridge->itemIf('grs_last_name', array($bridge->grs_last_name, ',')), $bridge->grs_first_name, $bridge->grs_surname_prefix), $this->_('Respondent'));
     $bridge->addItem('grs_gender');
     $bridge->addItem('grs_birthday');
     $bridge->addItem('grs_email');
     $bridge->addItem('gr2o_created');
     $bridge->addItem('gr2o_created_by');
     if ($this->onclick) {
         // TODO: can we not use $repeater?
         $href = array('location.href=\'', $this->onclick, '\';');
         foreach ($bridge->tbody() as $tr) {
             foreach ($tr as $td) {
                 if (strpos($td->class, 'linked') === false) {
                     $td->onclick = $href;
                 } else {
                     $td->onclick = 'event.cancelBubble=true;';
                 }
             }
         }
         $bridge->tbody()->onclick = '// Dummy for CSS';
     }
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:62,代码来源:DetailsWithAssignmentsSnippet.php


注:本文中的MUtil_Html类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。