本文整理汇总了PHP中ArrayData类的典型用法代码示例。如果您正苦于以下问题:PHP ArrayData类的具体用法?PHP ArrayData怎么用?PHP ArrayData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArrayData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: factory
/**
* @param array $data
* @return DrupalTermContentItem
*/
public static function factory($source, $data)
{
$item = new self($source, 'taxonomyterm:' . $data['tid']);
$item->DrupalID = $data['tid'];
$item->VocabularyID = $data['vid'];
$item->TermName = html_entity_decode($data['name']);
$item->Title = $item->TermName;
$item->Description = html_entity_decode($data['description']);
$item->Weight = $data['weight'];
if (isset($data['language'])) {
$item->Language = $data['language'];
}
if (isset($data['trid'])) {
$item->TRID = $data['trid'];
}
$item->Depth = $data['depth'];
$parents = new ArrayData(array());
foreach ($data['parents'] as $key => $value) {
$parents->setField($key, $value);
}
$item->Parents = $parents;
// Set the name for the tree.
$item->Name = $item->TermName;
return $item;
}
开发者ID:helpfulrobot,项目名称:silverstripe-drupal-connector,代码行数:29,代码来源:DrupalTaxonomyTermContentItem.php
示例2: getColumnContent
public function getColumnContent($field, $record, $col)
{
if ($record->canView()) {
$data = new ArrayData(array('Link' => Controller::join_links('CapturedEmailController', 'view', $record->ID)));
return $data->renderWith('ViewEmailButton');
}
}
示例3: getColumnContent
/**
* @param GridField $gridField
* @param DataObject $record
* @param string $columnName
*
* @return string - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName)
{
// No permission checks - handled through GridFieldDetailForm
// which can make the form readonly if no edit permissions are available.
$data = new ArrayData(array('Link' => $record->CMSEditLink()));
return $data->renderWith('GridFieldEditButton');
}
示例4: loadData
protected function loadData($data)
{
if (isset($data['link'])) {
$linkData = $data['link'];
$this->DrupalMenuLinkID = $linkData['mlid'];
$this->MenuTitle = html_entity_decode($linkData['title']);
$this->Description = $linkData['description'];
$this->Path = $linkData['path'];
$this->PathAlias = $linkData['path_alias'];
$this->Href = $linkData['href'];
$this->Hidden = $linkData['hidden'];
$this->External = $linkData['external'];
$this->HasChildren = $linkData['has_children'];
$this->Weight = $linkData['weight'];
$this->Depth = $linkData['depth'];
$options = new ArrayData(array());
foreach ($linkData['options'] as $key => $value) {
$options->setField($key, $value);
}
$this->Options = $options;
}
// Set the name for the tree.
$this->Name = $this->MenuTitle;
// Set up this default. It will get overridden by the DrupalNodeContentItem base class.
$this->Title = $this->MenuTitle;
}
示例5: onAfterInit
public function onAfterInit()
{
if ($this->owner instanceof DevelopmentAdmin || $this->owner instanceof DatabaseAdmin || class_exists('DevBuildController') && $this->owner instanceof DevBuildController) {
return;
}
// include the JS snippet into the frontend page markup
if (GoogleConfig::get_google_config('code')) {
$snippet = new ArrayData(array('GoogleAnalyticsCode' => GoogleConfig::get_google_config('code'), 'UseGoogleUniversalSnippet' => GoogleConfig::get_google_config('universal')));
Requirements::customScript($snippet->renderWith('GoogleAnalyticsJSSnippet'));
}
// if this request comes from a web crawler, leave a trace
if (isset($_SERVER['HTTP_USER_AGENT']) && $this->owner instanceof ContentController && $this->owner->data()->ID) {
foreach (GoogleLogger::$web_crawlers as $name => $signature) {
if (preg_match('/' . str_replace('/', "\\/", $signature) . '/i', $_SERVER['HTTP_USER_AGENT'])) {
$trace = new GoogleLogEvent();
$trace->Title = $name;
$trace->PageID = $this->owner->data()->ID;
$trace->write();
}
}
}
// include event tracking api if required, jQuery 1.5 is required for automatic data attributes
if (self::event_tracking_enabled()) {
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::javascript('googleanalytics/javascript/googleanalytics.event.tracking.js');
}
}
示例6: getColumnContent
public function getColumnContent($field, $record, $col)
{
if ($record->canView()) {
$data = new ArrayData(array('Link' => $record->Url));
return $data->renderWith('HailAttachmentDownloadButton');
}
}
示例7: getColumnContent
public function getColumnContent($field, $record, $col)
{
if ($record->canView()) {
$data = new ArrayData(array('Link' => singleton('HailModelAdmin')->Link($record->ClassName . '/EditForm/field/' . $record->ClassName . '/item/' . $record->ID)));
return $data->renderWith('GridFieldViewButton');
}
}
示例8: getColumnContent
public function getColumnContent($field, $record, $col)
{
if ($record->canView()) {
$data = new ArrayData(array('Link' => 'code-bank-api/export-package?id=' . $record->ID));
return $data->renderWith('ExportPackageButton');
}
}
示例9: getHTMLFragments
/**
* @param GridField $gridField
*
* @return array
*/
public function getHTMLFragments($gridField)
{
Requirements::css(CMC_BULKUPDATER_MODULE_DIR . '/css/CmcGridFieldBulkUpdater.css');
Requirements::javascript(CMC_BULKUPDATER_MODULE_DIR . '/javascript/CmcGridFieldBulkUpdater.js');
Requirements::add_i18n_javascript(CMC_BULKUPDATER_MODULE_DIR . '/lang/js');
//initialize column data
$cols = new ArrayList();
$fields = $gridField->getConfig()->getComponentByType('GridFieldEditableColumns')->getDisplayFields($gridField);
foreach ($gridField->getColumns() as $col) {
$fieldName = $col;
$fieldType = '';
$fieldLabel = '';
if (isset($fields[$fieldName])) {
$fieldData = $fields[$fieldName];
if (isset($fieldData['field'])) {
$fieldType = $fieldData['field'];
}
if (isset($fieldData['title'])) {
$fieldLabel = $fieldData['title'];
}
}
//Debug::show($fieldType);
if (class_exists($fieldType) && $fieldType != 'ReadonlyField') {
$field = new $fieldType($fieldName, $fieldLabel);
if ($fieldType == 'DatetimeField' || $fieldType == 'DateField' || $fieldType == 'TimeField') {
$field->setValue(date('Y-m-d H:i:s'));
$field->setConfig('showcalendar', true);
}
$cols->push(new ArrayData(array('UpdateField' => $field, 'Name' => $fieldName, 'Title' => $fieldLabel)));
} else {
$meta = $gridField->getColumnMetadata($col);
$cols->push(new ArrayData(array('Name' => $col, 'Title' => $meta['title'])));
}
}
$templateData = array();
if (!count($this->config['actions'])) {
user_error('Trying to use GridFieldBulkManager without any bulk action.', E_USER_ERROR);
}
//set up actions
$actionsListSource = array();
$actionsConfig = array();
foreach ($this->config['actions'] as $action => $actionData) {
$actionsListSource[$action] = $actionData['label'];
$actionsConfig[$action] = $actionData['config'];
}
reset($this->config['actions']);
$firstAction = key($this->config['actions']);
$dropDownActionsList = DropdownField::create('bulkActionName', '')->setSource($actionsListSource)->setAttribute('class', 'bulkActionName no-change-track')->setAttribute('id', '');
//initialize buttonLabel
$buttonLabel = _t('CMC_GRIDFIELD_BULK_UPDATER.ACTION1_BTN_LABEL', $this->config['actions'][$firstAction]['label']);
//add menu if more than one action
if (count($this->config['actions']) > 1) {
$templateData = array('Menu' => $dropDownActionsList->FieldHolder());
$buttonLabel = _t('CMC_GRIDFIELD_BULK_UPDATER.ACTION_BTN_LABEL', 'Go');
}
//Debug::show($buttonLabel);
$templateData = array_merge($templateData, array('Button' => array('Label' => $buttonLabel, 'Icon' => $this->config['actions'][$firstAction]['config']['icon']), 'Select' => array('Label' => _t('CMC_GRIDFIELD_BULK_UPDATER.SELECT_ALL_LABEL', 'Select all')), 'Colspan' => count($gridField->getColumns()) - 1, 'Cols' => $cols));
$templateData = new ArrayData($templateData);
return array('header' => $templateData->renderWith('CmcBulkUpdaterButtons'));
}
示例10: trackbackping
function trackbackping() {
$error = 0;
$message = '';
if(!(isset($_POST['url']) && $_POST['url'])) {
$error = 1;
$message = 'Missing required POST parameter \'url\'.';
} else {
$trackbackping = new TrackBackPing();
$trackbackping->Url = $_POST['url'];
if(isset($_POST['title']) && $_POST['title']) {
$trackbackping->Title = $_POST['title'];
}
if(isset($_POST['excerpt']) && $_POST['excerpt']) {
$trackbackping->Excerpt = $_POST['excerpt'];
}
if(isset($_POST['blog_name']) && $_POST['blog_name']) {
$trackbackping->BlogName = $_POST['blog_name'];
}
$trackbackping->PageID = $this->owner->ID;
$trackbackping->write();
}
$returnData = new ArrayData(array(
'Error' => $error,
'Message' => $message
));
return $returnData->renderWith('TrackBackPingReturn');
}
示例11: FieldHolder
public function FieldHolder($attributes = array())
{
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::css("registration/css/affiliations.css");
Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js");
Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js");
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
$js_scripts = array("themes/openstack/javascript/pure.min.js", "themes/openstack/javascript/jquery.serialize.js", "themes/openstack/javascript/jquery.cleanform.js", "themes/openstack/javascript/jquery.ui.datepicker.validation.package-1.0.1/jquery.ui.datepicker.validation.js", "themes/openstack/javascript/jquery.validate.custom.methods.js", 'registration/javascript/affiliations.js');
foreach ($js_scripts as $js) {
Requirements::javascript($js);
}
$arrayData = new ArrayData(array('Title' => 'Edit Affiliation'));
$modal = $arrayData->renderWith('AffiliationModalForm');
$modal = trim(preg_replace('/\\s\\s+/', ' ', $modal));
$script = <<<JS
(function( \$ ){
\$(document).ready(function() {
\$('{$modal}').appendTo(\$('body'));
\$("#edit-affiliation-form").affiliations({
storage:'{$this->mode}'
});
});
}( jQuery ));
JS;
Requirements::customScript($script);
return parent::FieldHolder($attributes);
}
示例12: getHTMLFragments
/**
*
* @param GridField $gridField
* @return string - HTML
*/
public function getHTMLFragments($gridField)
{
$searchState = $gridField->State->GridFieldSearchRelation;
$dataClass = $gridField->getList()->dataClass();
$forTemplate = new ArrayData(array());
$forTemplate->Fields = new ArrayList();
$searchFields = $this->getSearchFields() ? $this->getSearchFields() : $this->scaffoldSearchFields($dataClass);
$value = $this->findSingleEntry($gridField, $searchFields, $searchState, $dataClass);
$searchField = new TextField('gridfield_relationsearch', _t('GridField.RelationSearch', "Relation search"), $value);
// Apparently the data-* needs to be double qouted for the jQuery.meta data plugin
$searchField->setAttribute('data-search-url', '\'' . Controller::join_links($gridField->Link('search') . '\''));
$searchField->setAttribute('placeholder', $this->getPlaceholderText($dataClass));
$searchField->addExtraClass('relation-search no-change-track');
$findAction = new GridField_FormAction($gridField, 'gridfield_relationfind', _t('GridField.Find', "Find"), 'find', 'find');
$findAction->setAttribute('data-icon', 'relationfind');
$addAction = new GridField_FormAction($gridField, 'gridfield_relationadd', _t('GridField.LinkExisting', "Link Existing"), 'addto', 'addto');
$addAction->setAttribute('data-icon', 'chain--plus');
// If an object is not found, disable the action
if (!is_int($gridField->State->GridFieldAddRelation)) {
$addAction->setReadonly(true);
}
$forTemplate->Fields->push($searchField);
$forTemplate->Fields->push($findAction);
$forTemplate->Fields->push($addAction);
return array($this->targetFragment => $forTemplate->renderWith($this->itemClass));
}
示例13: getColumnContent
public function getColumnContent($field, $record, $col)
{
if ($record->canView()) {
$data = new ArrayData(array('Link' => Controller::join_links($field->Link('item'), $record->ID, 'version', $record->Version, 'view')));
return $data->renderWith('GridFieldViewButton');
}
}
开发者ID:helpfulrobot,项目名称:studiobonito-silverstripe-publishable,代码行数:7,代码来源:PublishableGridFieldViewButton.php
示例14: getColumnContent
/**
*
* @param GridField $gridField
* @param DataObject $record
* @param string $columnName
* @return string - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName)
{
// No permission checks, handled through GridFieldDetailForm,
// which can make the form readonly if no edit permissions are available.
$data = new ArrayData(array('Link' => Controller::join_links($gridField->Link('item'), $record->ID, 'version', $record->Version, 'edit')));
return $data->renderWith('GridFieldEditButton');
}
开发者ID:helpfulrobot,项目名称:studiobonito-silverstripe-publishable,代码行数:14,代码来源:PublishableGridFieldEditButton.php
示例15: getColumnContent
/**
*
* @param GridField $gridField
* @param DataObject $record
* @param string $columnName
* @return string - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName)
{
$data = new ArrayData(array('Link' => Controller::join_links($gridField->Link('item'), $record->ID, 'refresh')));
$templatePath = dirname(dirname(__FILE__)) . '/templates/GridFieldRefreshButton.ss';
$templatePath = str_replace(BASE_PATH, '', $templatePath);
return $data->renderWith('../' . $templatePath);
}