getTemplateVarsFromRowColumn() публичный Метод

Subclasses have to implement this method to extract variables for a given column from a data element so that they may be assigned to template before rendering.
public getTemplateVarsFromRowColumn ( $row, $column ) : array
$row GridRow
$column GridColumn
Результат array
 /**
  * Extracts variables for a given column from a data element
  * so that they may be assigned to template before rendering.
  * @param $row GridRow
  * @param $column GridColumn
  * @return array
  */
 function getTemplateVarsFromRowColumn($row, $column)
 {
     $userGroup = $row->getData();
     /* @var $userGroup UserGroup */
     $columnId = $column->getId();
     $workflowStages = Application::getApplicationStages();
     $roleDao = DAORegistry::getDAO('RoleDAO');
     /* @var $roleDao RoleDAO */
     $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
     /* @var $userGroupDao UserGroupDAO */
     $assignedStages = $userGroupDao->getAssignedStagesByUserGroupId($userGroup->getContextId(), $userGroup->getId());
     switch ($columnId) {
         case 'name':
             return array('label' => $userGroup->getLocalizedName());
         case 'abbrev':
             return array('label' => $userGroup->getLocalizedAbbrev());
         case in_array($columnId, $workflowStages):
             // Set the state of the select element that will
             // be used to assign the stage to the user group.
             $selectDisabled = false;
             if (in_array($columnId, $roleDao->getForbiddenStages($userGroup->getRoleId()))) {
                 // This stage should not be assigned to the user group.
                 $selectDisabled = true;
             }
             return array('selected' => in_array($columnId, array_keys($assignedStages)), 'disabled' => $selectDisabled);
         default:
             break;
     }
     return parent::getTemplateVarsFromRowColumn($row, $column);
 }
 /**
  * This implementation assumes a simple data element array that
  * has column ids as keys.
  * @see GridCellProvider::getTemplateVarsFromRowColumn()
  * @param $row GridRow
  * @param $column GridColumn
  * @return array
  */
 function getTemplateVarsFromRowColumn($row, $column)
 {
     $file = $row->getData();
     $columnId = $column->getId();
     assert(is_a($file, 'SubmissionFile') && !empty($columnId));
     switch ($columnId) {
         case 'name':
             return array('labelKey' => $file->getFileId(), 'label' => '<span class="label before_actions">' . $file->getFileId() . '-' . $file->getRevision() . '</span>' . htmlspecialchars($file->getFileLabel()));
     }
     return parent::getTemplateVarsFromRowColumn($row, $column);
 }
 /**
  * Extracts variables for a given column from a data element
  * so that they may be assigned to template before rendering.
  * @param $row GridRow
  * @param $column GridColumn
  * @return array
  */
 function getTemplateVarsFromRowColumn($row, $column)
 {
     $announcementType = $row->getData();
     $columnId = $column->getId();
     assert(is_a($announcementType, 'AnnouncementType') && !empty($columnId));
     switch ($columnId) {
         case 'title':
             return array('label' => $announcementType->getLocalizedName());
             break;
         default:
             break;
     }
     return parent::getTemplateVarsFromRowColumn($row, $column);
 }
 /**
  * @copydoc GridCellProvider::getTemplateVarsFromRowColumn()
  */
 function getTemplateVarsFromRowColumn($row, $column)
 {
     $monograph = $row->getData();
     switch ($column->getId()) {
         case 'id':
             return array('label' => $monograph->getId());
         case 'title':
             // Delegate to the submission grid cell provider that holds the logic
             // for the submission title plus author name.
             $user = Application::getRequest()->getUser();
             import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider');
             $submissionsListCellProvider = new SubmissionsListGridCellProvider($user);
             return $submissionsListCellProvider->getTemplateVarsFromRowColumn($row, $column);
         case 'isFeatured':
             $featureDao = DAORegistry::getDAO('FeatureDAO');
             return array('selected' => $featureDao->isFeatured($monograph->getId(), $this->_assocType, $this->_assocId));
         case 'isNewRelease':
             $newReleaseDao = DAORegistry::getDAO('NewReleaseDAO');
             return array('selected' => $newReleaseDao->isNewRelease($monograph->getId(), $this->_assocType, $this->_assocId));
     }
     return parent::getTemplateVarsFromRowColumn($row, $column);
 }
Пример #5
0
 /**
  * Extracts variables for a given column from a data element
  * so that they may be assigned to template before rendering.
  * @param $row GridRow
  * @param $column GridColumn
  * @return array
  */
 function getTemplateVarsFromRowColumn($row, $column)
 {
     $plugin =& $row->getData();
     $columnId = $column->getId();
     assert(is_a($plugin, 'Plugin') && !empty($columnId));
     switch ($columnId) {
         case 'name':
             return array('label' => $plugin->getDisplayName());
             break;
         case 'category':
             return array('label' => $plugin->getCategory());
             break;
         case 'description':
             return array('label' => $plugin->getDescription());
             break;
         case 'enabled':
             $isEnabled = $plugin->getEnabled();
             return array('selected' => $isEnabled, 'disabled' => $isEnabled ? !$plugin->getCanDisable() : !$plugin->getCanEnable());
         default:
             break;
     }
     return parent::getTemplateVarsFromRowColumn($row, $column);
 }
 /**
  * Extracts variables for a given column from a data element
  * so that they may be assigned to template before rendering.
  * @param $row GridRow
  * @param $column GridColumn
  * @return array
  */
 function getTemplateVarsFromRowColumn($row, $column)
 {
     $announcement = $row->getData();
     $columnId = $column->getId();
     assert(is_a($announcement, 'Announcement') && !empty($columnId));
     switch ($columnId) {
         case 'title':
             return array('label' => '');
             break;
         case 'type':
             $typeId = $announcement->getTypeId();
             if ($typeId) {
                 $announcementTypeDao = DAORegistry::getDAO('AnnouncementTypeDAO');
                 $announcementType = $announcementTypeDao->getById($typeId);
                 return array('label' => $announcementType->getLocalizedTypeName());
             } else {
                 return array('label' => __('common.none'));
             }
             break;
         default:
             break;
     }
     return parent::getTemplateVarsFromRowColumn($row, $column);
 }
Пример #7
0
 /**
  * Extracts variables for a given column from a data element
  * so that they may be assigned to template before rendering.
  * @param $row GridRow
  * @param $column GridColumn
  * @return array
  */
 function getTemplateVarsFromRowColumn($row, $column)
 {
     $signoff = $row->getData();
     /* @var $element Signoff */
     $columnId = $column->getId();
     assert(is_a($signoff, 'Signoff') && !empty($columnId));
     if ($columnId == 'name') {
         return array('label' => $this->_getLabel($signoff));
     }
     return parent::getTemplateVarsFromRowColumn($row, $column);
 }
Пример #8
0
 /**
  * Extracts variables for a given column from a data element
  * so that they may be assigned to template before rendering.
  * @param $row GridRow
  * @param $column GridColumn
  * @return array
  */
 function getTemplateVarsFromRowColumn($row, $column)
 {
     $plugin =& $row->getData();
     $columnId = $column->getId();
     assert(is_a($plugin, 'Plugin') && !empty($columnId));
     switch ($columnId) {
         case 'name':
             return array('label' => $plugin->getDisplayName());
             break;
         case 'category':
             return array('label' => $plugin->getCategory());
             break;
         case 'description':
             return array('label' => $plugin->getDescription());
             break;
         case 'enabled':
             // Assume that every plugin is enabled...
             $enabled = true;
             // ... and that it doesn't have enable or disable management verbs.
             $hasVerbs = false;
             // Check if plugin can be disabled.
             if (is_callable(array($plugin, 'getEnabled'))) {
                 // Plugin can be disabled, so check its current state.
                 if (!$plugin->getEnabled()) {
                     $enabled = false;
                 }
                 // Check if plugin has management verbs to
                 // disable or enable.
                 $managementVerbs = $plugin->getManagementVerbs();
                 if (!is_null($managementVerbs)) {
                     foreach ($managementVerbs as $verb) {
                         list($verbName) = $verb;
                         if ($verbName === 'enable' || $verbName === 'disable') {
                             $hasVerbs = true;
                             break;
                         }
                     }
                 }
             } else {
                 // Plugin cannot be disabled so it also doesn't
                 // have management verbs to those actions.
                 $hasVerbs = false;
             }
             // Set the state of the select element that will
             // be used to enable or disable the plugin.
             $selectDisabled = true;
             if ($hasVerbs) {
                 // Plugin have management verbs.
                 // Show an enabled select element.
                 $selectDisabled = false;
             }
             return array('selected' => $enabled, 'disabled' => $selectDisabled);
         default:
             break;
     }
     return parent::getTemplateVarsFromRowColumn($row, $column);
 }