本文整理汇总了PHP中GridCellProvider::getTemplateVarsFromRowColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP GridCellProvider::getTemplateVarsFromRowColumn方法的具体用法?PHP GridCellProvider::getTemplateVarsFromRowColumn怎么用?PHP GridCellProvider::getTemplateVarsFromRowColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridCellProvider
的用法示例。
在下文中一共展示了GridCellProvider::getTemplateVarsFromRowColumn方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTemplateVarsFromRowColumn
/**
* 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);
}
示例2: getTemplateVarsFromRowColumn
/**
* 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);
}
示例3: getTemplateVarsFromRowColumn
/**
* 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);
}
示例4: getTemplateVarsFromRowColumn
/**
* @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: getTemplateVarsFromRowColumn
/**
* 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);
}
示例6: getTemplateVarsFromRowColumn
/**
* 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: getTemplateVarsFromRowColumn
/**
* 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: getTemplateVarsFromRowColumn
/**
* 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);
}