本文整理汇总了PHP中ArrayData类的典型用法代码示例。如果您正苦于以下问题:PHP ArrayData类的具体用法?PHP ArrayData怎么用?PHP ArrayData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArrayData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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');
}
}
开发者ID:helpfulrobot,项目名称:silverstripe-australia-mailcapture,代码行数:7,代码来源:MassMailSend.php
示例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');
}
开发者ID:micmania1,项目名称:silverstripe-lumberjack,代码行数:14,代码来源:GridFieldSiteTreeEditButton.php
示例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;
}
开发者ID:robert-h-curry,项目名称:silverstripe-drupal-connector,代码行数:26,代码来源:DrupalMenuLinkContentItem.php
示例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');
}
}
开发者ID:helpfulrobot,项目名称:jelicanin-silverstripe-googleanalytics,代码行数:27,代码来源:GoogleLogger.php
示例6: getColumnContent
public function getColumnContent($field, $record, $col)
{
if ($record->canView()) {
$data = new ArrayData(array('Link' => $record->Url));
return $data->renderWith('HailAttachmentDownloadButton');
}
}
开发者ID:firebrandhq,项目名称:silverstripe-hail,代码行数:7,代码来源:GridFieldHailAttachementDownButton.php
示例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');
}
}
开发者ID:firebrandhq,项目名称:silverstripe-hail,代码行数:7,代码来源:GridFieldHailViewButton.php
示例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');
}
}
开发者ID:helpfulrobot,项目名称:undefinedoffset-silverstripe-codebank,代码行数:7,代码来源:ExportPackageButton.php
示例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'));
}
开发者ID:cmcramer,项目名称:cmc-silverstripe-gridfieldbulkupdater,代码行数:65,代码来源:CmcGridFieldBulkUpdater.php
示例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');
}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:30,代码来源:TrackBackDecorator.php
示例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);
}
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:31,代码来源:AffiliationField.php
示例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));
}
开发者ID:normann,项目名称:sapphire,代码行数:31,代码来源:GridFieldAddExistingAutocompleter.php
示例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);
}
开发者ID:richardsjoqvist,项目名称:silverstripe-blocks,代码行数:14,代码来源:FeedBlock_GridFieldRefreshButton.php
示例16: factory
/**
* @param array $data
* @return DrupalTermContentItem
*/
public static function factory($source, $data)
{
$linkData = $data['link'];
$item = new self($source, 'menulink:' . $linkData['mlid']);
$item->DrupalID = $linkData['mlid'];
$item->Title = html_entity_decode($linkData['title']);
$item->MenuTitle = $item->Title;
$item->Description = $linkData['description'];
$item->Path = $linkData['path'];
$item->PathAlias = $linkData['path_alias'];
$item->Href = $linkData['href'];
$item->Hidden = $linkData['hidden'];
$item->External = $linkData['external'];
$item->HasChildren = $linkData['has_children'];
$item->Weight = $linkData['weight'];
$item->Depth = $linkData['depth'];
$options = new ArrayData(array());
if (isset($linkData['options'])) {
foreach ($linkData['options'] as $key => $value) {
$options->setField($key, $value);
}
}
$item->Options = $options;
// Set the name for the tree.
$item->Name = $item->MenuTitle;
// Check if we have to load any node content
$item->Node = NULL;
if (strlen($item->Path) > 5 && substr($item->Path, 0, 5) == 'node/') {
$nodeId = 'node:' . substr($item->Path, 5);
$item->Node = $source->getObject($source->encodeId($nodeId));
$item->Title = $item->Node->Title;
}
return $item;
}
开发者ID:helpfulrobot,项目名称:silverstripe-drupal-connector,代码行数:38,代码来源:DrupalMenuLinkContentItem.php
示例17: getHTMLFragments
public function getHTMLFragments($gridField)
{
$model = Injector::inst()->create($gridField->getModelClass());
$parent = SiteTree::get()->byId(Controller::curr()->currentPageID());
if (!$model->canCreate()) {
return array();
}
$children = $this->getAllowedChildren($parent);
if (count($children) > 1) {
$pageTypes = DropdownField::create("PageType", "Page Type", $children, $model->defaultChild());
$pageTypes->setFieldHolderTemplate("GridFieldSiteTreeAddNewButton_holder")->addExtraClass("gridfield-dropdown no-change-track");
if (!$this->buttonName) {
$this->buttonName = _t('GridFieldSiteTreeAddNewButton.AddMultipleOptions', 'Add new', "Add button text for multiple options.");
}
} else {
$keys = array_keys($children);
$pageTypes = HiddenField::create('PageType', 'Page Type', $keys[0]);
if (!$this->buttonName) {
$this->buttonName = _t('GridFieldSiteTreeAddNewButton.Add', 'Add new {name}', 'Add button text for a single option.', array($children[$keys[0]]));
}
}
$state = $gridField->State->GridFieldSiteTreeAddNewButton;
$state->currentPageID = $parent->ID;
$state->pageType = $parent->defaultChild();
$addAction = new GridField_FormAction($gridField, 'add', $this->buttonName, 'add', 'add');
$addAction->setAttribute('data-icon', 'add')->addExtraClass("no-ajax ss-ui-action-constructive dropdown-action");
$forTemplate = new ArrayData(array());
$forTemplate->Fields = new ArrayList();
$forTemplate->Fields->push($pageTypes);
$forTemplate->Fields->push($addAction);
Requirements::css(LUMBERJACK_DIR . "/css/lumberjack.css");
Requirements::javascript(LUMBERJACK_DIR . "/javascript/GridField.js");
return array($this->targetFragment => $forTemplate->renderWith("GridFieldSiteTreeAddNewButton"));
}
开发者ID:micmania1,项目名称:silverstripe-lumberjack,代码行数:34,代码来源:GridFieldSiteTreeAddNewButton.php
示例18: getHTMLFragments
/**
* Returns a map where the keys are fragment names and the values are pieces of HTML to add to these fragments.
* @param GridField $gridField Grid Field Reference
* @return Array Map where the keys are fragment names and the values are pieces of HTML to add to these fragments.
*/
public function getHTMLFragments($gridField)
{
$dataList = $gridField->getList();
if (class_exists('UnsavedRelationList') && $dataList instanceof UnsavedRelationList) {
return array();
}
$state = $gridField->State->GridFieldSortableRows;
if (!is_bool($state->sortableToggle)) {
$state->sortableToggle = false;
}
//Ensure user can edit
if (!singleton($gridField->getModelClass())->canEdit()) {
return array();
}
//Sort order toggle
$sortOrderToggle = GridField_FormAction::create($gridField, 'sortablerows-toggle', 'sorttoggle', 'sortableRowsToggle', null)->addExtraClass('sortablerows-toggle');
$sortOrderSave = GridField_FormAction::create($gridField, 'sortablerows-savesort', 'savesort', 'saveGridRowSort', null)->addExtraClass('sortablerows-savesort');
//Sort to Page Action
$sortToPage = GridField_FormAction::create($gridField, 'sortablerows-sorttopage', 'sorttopage', 'sortToPage', null)->addExtraClass('sortablerows-sorttopage');
$data = array('SortableToggle' => $sortOrderToggle, 'SortOrderSave' => $sortOrderSave, 'SortToPage' => $sortToPage, 'Checked' => $state->sortableToggle == true ? ' checked = "checked"' : '', 'List' => $dataList);
$forTemplate = new ArrayData($data);
//Inject Requirements
$custom = Config::inst()->get('GridFieldSortableRows', 'Base');
$base = $custom ?: SORTABLE_GRIDFIELD_BASE;
Requirements::css($base . '/css/GridFieldSortableRows.css');
Requirements::javascript($base . '/javascript/GridFieldSortableRows.js');
$args = array('Colspan' => count($gridField->getColumns()), 'ID' => $gridField->ID(), 'DisableSelection' => $this->disable_selection);
$fragments = array('header' => $forTemplate->renderWith('GridFieldSortableRows', $args));
if ($gridField->getConfig()->getComponentByType('GridFieldPaginator')) {
$fragments['after'] = $forTemplate->renderWith('GridFieldSortableRows_paginator');
}
return $fragments;
}
开发者ID:helpfulrobot,项目名称:maldicore-sortablegridfield,代码行数:38,代码来源:GridFieldSortableRows.php
示例19: getHTMLFragments
public function getHTMLFragments($gridField) {
$data = new ArrayData(array(
'NewLink' => Controller::join_links($gridField->Link('item'), 'new'),
));
return array(
$this->targetFragment => $data->renderWith('GridFieldAddNewbutton'),
);
}
开发者ID:redema,项目名称:sapphire,代码行数:8,代码来源:GridFieldAddNewButton.php
示例20: testIncludeTruthyness
public function testIncludeTruthyness()
{
$data = new ArrayData(array('Title' => 'TruthyTest', 'Items' => new ArrayList(array(new ArrayData(array('Title' => 'Item 1')), new ArrayData(array('Title' => '')), new ArrayData(array('Title' => true)), new ArrayData(array('Title' => false)), new ArrayData(array('Title' => null)), new ArrayData(array('Title' => 0)), new ArrayData(array('Title' => 7))))));
$result = $data->renderWith('SSViewerTestIncludeScopeInheritanceWithArgs');
// We should not end up with empty values appearing as empty
$expected = array('Item 1 _ Item 1 - First-ODD top:Item 1', 'Untitled - EVEN top:', '1 _ 1 - ODD top:1', 'Untitled - EVEN top:', 'Untitled - ODD top:', 'Untitled - EVEN top:0', '7 _ 7 - Last-ODD top:7');
$this->assertExpectedStrings($result, $expected);
}
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:8,代码来源:SSViewerTest.php
注:本文中的ArrayData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论