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


PHP ArrayData::renderWith方法代码示例

本文整理汇总了PHP中ArrayData::renderWith方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayData::renderWith方法的具体用法?PHP ArrayData::renderWith怎么用?PHP ArrayData::renderWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArrayData的用法示例。


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

示例1: 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

示例2: 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

示例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: 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

示例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' => 'code-bank-api/export-package?id=' . $record->ID));
         return $data->renderWith('ExportPackageButton');
     }
 }
开发者ID:helpfulrobot,项目名称:undefinedoffset-silverstripe-codebank,代码行数:7,代码来源:ExportPackageButton.php

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例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: 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

示例14: 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

示例15: 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


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