本文整理汇总了PHP中Util::makeRandomKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::makeRandomKey方法的具体用法?PHP Util::makeRandomKey怎么用?PHP Util::makeRandomKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util
的用法示例。
在下文中一共展示了Util::makeRandomKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: end
public function end()
{
$this->privateName = 'customgrid_' . Util::makeRandomKey();
$storePrivateName = 'store_' . Util::makeRandomKey();
$templatePrivateName = 'tpl_' . Util::makeRandomKey();
$xtemplatePrivateName = 'xtpl_' . Util::makeRandomKey();
$dataviewPrivateName = 'dv_' . Util::makeRandomKey();
$this->attributes[$storePrivateName]['url'] = $this->proxy['url'];
$this->attributes[$storePrivateName]['root'] = 'rows';
$this->attributes[$storePrivateName]['fields'][] = $this->afExtjs->asAnonymousClass(array('name' => 'message'));
$this->attributes[$storePrivateName]['fields'][] = $this->afExtjs->asAnonymousClass(array('name' => 'redirect'));
$this->attributes[$storePrivateName]['fields'][] = $this->afExtjs->asAnonymousClass(array('name' => 'html'));
$this->attributes[$storePrivateName]['listeners']['load'] = $this->afExtjs->asMethod(array("parameters" => "object,records,options", "source" => 'if(records.length>0&&records[0].json.redirect&&records[0].json.message){var rec=records[0].json;Ext.Msg.alert("Failure", rec.message, function(){afApp.loadCenterWidget(rec.redirect);});}'));
$this->afExtjs->private[$storePrivateName] = $this->afExtjs->JsonStore($this->attributes[$storePrivateName]);
unset($this->attributes[$storePrivateName]);
$this->afExtjs->private[$templatePrivateName] = '<tpl for="."><div class="item-wrap"><div class="item">{html}</div></div></tpl><div class="x-clear"></div>';
$this->afExtjs->private[$xtemplatePrivateName] = $this->afExtjs->XTemplate(array($templatePrivateName));
$this->attributes[$dataviewPrivateName]['store'] = $this->afExtjs->asVar($storePrivateName);
$this->attributes[$dataviewPrivateName]['tpl'] = $this->afExtjs->asVar($xtemplatePrivateName);
$this->attributes[$dataviewPrivateName]['autoHeight'] = true;
$this->attributes[$dataviewPrivateName]['multiSelect'] = true;
$this->attributes[$dataviewPrivateName]['overClass'] = 'x-view-over';
$this->attributes[$dataviewPrivateName]['itemSelector'] = 'div.item-wrap';
$this->attributes[$dataviewPrivateName]['emptyText'] = 'No data to display !';
$this->attributes[$dataviewPrivateName]['plugins'][] = "new Ext.DataView.DragSelector()";
$this->afExtjs->private[$dataviewPrivateName] = $this->afExtjs->DataView($this->attributes[$dataviewPrivateName]);
unset($this->attributes[$dataviewPrivateName]);
$this->addItem($dataviewPrivateName);
@($this->attributes['listeners']['render']["source"] .= $storePrivateName . ".load();");
$attributes['listeners']['render']["source"] = $this->attributes['listeners']['render']["source"];
unset($this->attributes['listeners']['render']["source"]);
$this->attributes['listeners']['render'] = $this->afExtjs->asMethod(array("parameters" => "", "source" => $attributes['listeners']['render']["source"]));
unset($attributes['listeners']['render']["source"]);
$this->afExtjs->private[$this->privateName] = $this->afExtjs->Panel($this->attributes);
}
示例2: __construct
public function __construct($attributes = array())
{
$this->afExtjs = afExtjs::getInstance();
$this->afExtjs->setAddons(array('js' => array('/appFlowerPlugin/js/custom/cheatJS.js')));
$this->privateName = 'panel_' . Util::makeRandomKey();
$this->attributes['id'] = $this->privateName;
if (isset($attributes['idxml']) && $attributes['idxml']) {
$this->attributes['id'] = $attributes['idxml'];
}
if (isset($attributes['plugins'])) {
$this->attributes['plugins'][] = $attributes['plugins'];
unset($attributes['plugins']);
}
if (isset($attributes['portal']) && $attributes['portal'] == true) {
$this->attributes = array_merge($this->attributes, array('anchor' => '100%', 'frame' => true, 'collapsible' => true, 'draggable' => true, 'maximizable' => true, 'cls' => 'x-portlet'));
$this->attributes['plugins'][] = 'new Ext.ux.MaximizeTool()';
unset($attributes['portal']);
}
if (isset($attributes['tools'])) {
$this->attributes['tools'] = $attributes['tools']->end();
unset($attributes['tools']);
}
$this->attributes['getWidgetConfig'] = $this->afExtjs->asMethod("var o={}; o.idxml=this.idxml || false; return o;");
if (count($attributes) > 0) {
$this->attributes = array_merge($this->attributes, $attributes);
}
$this->attributes['listeners']['bodyresize'] = $this->afExtjs->asMethod(array("parameters" => "object,layout", "source" => "if(object.ownerCt.ownerCt)object.ownerCt.ownerCt.doLayout();"));
if (isset($attributes['autoEnd']) && $attributes['autoEnd'] || !isset($attributes['autoEnd'])) {
$this->end();
}
}
示例3: __construct
public function __construct($attributes = array())
{
$this->afExtjs = afExtjs::getInstance();
$this->portalPrivateName = 'portal_' . Util::makeRandomKey();
if (isset($attributes['portalLayoutType'])) {
$this->attributes['portal']['portalLayoutType'] = $attributes['portalLayoutType'];
unset($attributes['portalLayoutType']);
}
if (isset($attributes['portalWidgets'])) {
$this->attributes['portal']['portalWidgets'] = $attributes['portalWidgets'];
unset($attributes['portalWidgets']);
}
/**
* fixing ticket #1295 part 2
*
* @author Radu Topala <radu@appflower.com>
*/
$this->attributes['portal']['dropConfig']['ddGroup'] = $this->portalPrivateName . '_dd';
$this->attributes['portal']['bodyBorder'] = false;
$this->attributes['portal']['autoWidth'] = true;
@($this->attributes['portal']['style'] .= 'padding-right:5px;');
@($this->attributes['portal']['bodyStyle'] .= 'overflow-x:hidden;overflow-y:hidden;padding-right:5px;');
if (count($attributes) > 0) {
$this->attributes = array_merge($this->attributes, $attributes);
}
}
示例4: __construct
public function __construct($attributes = array())
{
$this->afExtjs = afExtjs::getInstance();
$this->privateName = 'form_' . Util::makeRandomKey();
$this->attributes['name'] = $this->privateName;
$this->attributes['id'] = $this->privateName;
//$this->attributes['defaults']=array('labelStyle'=>'width:75px;font-size:11px;font-weight:bold;padding:0 3px 3px 0;');
if (isset($attributes['labelWidth'])) {
//$this->attributes['defaults']=array('labelStyle'=>'width:'.$attributes['labelWidth'].'px;font-size:11px;font-weight:bold;padding:0 3px 3px 0;');
}
/*if(isset($attributes['idxml'])&&$attributes['idxml'])
{
$this->attributes['id']=$attributes['idxml'];
}*/
$this->afExtjs->setAddons(array('css' => array('/appFlowerPlugin/css/my-extjs.css', $this->afExtjs->getPluginsDir() . 'multiselect/multiselect.css'), 'js' => array($this->afExtjs->getPluginsDir() . 'multiselect/DDView.js', $this->afExtjs->getPluginsDir() . 'multiselect/MultiSelect.js', $this->afExtjs->getPluginsDir() . 'multiselect/ItemSelector.js', $this->afExtjs->getPluginsDir() . 'multiselect/Ext.ux.TreeItemSelector.js', $this->afExtjs->getPluginsDir() . 'tree/Ext.tree.TreeSerializer.js', $this->afExtjs->getPluginsDir() . 'form/Ext.ux.ClassicFormPanel.js', $this->afExtjs->getPluginsDir() . 'form/Ext.ux.form.ComboWButton.js')));
if (isset($attributes['action'])) {
$this->attributes['url'] = $attributes['action'];
unset($attributes['action']);
}
if (isset($attributes['portal']) && $attributes['portal'] == true) {
$this->attributes = array_merge($this->attributes, array('anchor' => '100%', 'frame' => true, 'collapsible' => true, 'draggable' => true, 'cls' => 'x-portlet'));
unset($attributes['portal']);
}
if (isset($attributes['tools'])) {
$this->attributes['tools'] = $attributes['tools']->end();
unset($attributes['tools']);
}
$this->attributes['getWidgetConfig'] = $this->afExtjs->asMethod("var o={}; o.idxml=this.idxml || false; return o;");
if (count($attributes) > 0) {
$this->attributes = array_merge($this->attributes, $attributes);
}
}
示例5: __construct
public function __construct($attributes = array())
{
$this->afExtjs = afExtjs::getInstance();
if (count($attributes)) {
$this->attributes = array_merge($this->attributes, $attributes);
}
$this->privateName = 'menu_' . Util::makeRandomKey();
}
示例6: __construct
public function __construct($attributes = array())
{
$this->afExtjs = afExtjs::getInstance();
$this->afExtjs->setAddons(array('js' => array($this->afExtjs->getPluginsDir() . 'comet/Ext.Comet.js', $this->afExtjs->getPluginsDir() . 'comet/Ext.ux.Updater.js')));
$this->privateName = 'updater_' . Util::makeRandomKey();
$this->attributes['id'] = $this->privateName;
if (count($attributes) > 0) {
$this->attributes = array_merge($this->attributes, $attributes);
}
$this->end();
}
示例7: __construct
public function __construct($attributes = array())
{
$this->afExtjs = afExtjs::getInstance();
$this->privateName = 'window_' . Util::makeRandomKey();
$this->attributes['id'] = $this->privateName;
if (isset($attributes['tools'])) {
$this->attributes['tools'] = $attributes['tools']->end();
unset($attributes['tools']);
}
if (count($attributes) > 0) {
$this->attributes = array_merge($this->attributes, $attributes);
}
}
示例8: __construct
public function __construct($containerObject, $attributes = array())
{
$this->afExtjs = afExtjs::getInstance();
$this->privateName = 'field_' . Util::makeRandomKey();
$this->attributes['xtype'] = 'multiselect';
$this->attributes['width'] = '250';
$this->attributes['height'] = '100';
if (isset($attributes['plugin']) && $attributes['plugin'] == 'listfield') {
$this->afExtjs->setAddons(array('js' => array($this->afExtjs->getPluginsDir() . 'multiselect/ListField.js')));
$this->attributes['xtype'] = 'listfield';
$this->attributes['height'] = 250;
}
if (isset($attributes['name'])) {
$this->attributes['name'] = $attributes['name'];
$this->attributes['id'] = $this->privateName;
}
/**
* add a button to clear the selection
*/
if (isset($attributes['clear'])) {
$this->attributes['tbar'] = array($this->afExtjs->asAnonymousClass(array('text' => 'clear', 'handler' => $this->afExtjs->asMethod(array('parameters' => '', 'source' => 'Ext.getCmp("' . $this->attributes['id'] . '").reset();')))));
unset($attributes['clear']);
}
/**
* the options attribute, an assoc array for now
*/
if (isset($attributes['options']) && count($attributes['options']) > 0) {
$options = array();
foreach ($attributes['options'] as $key => $value) {
$options[] = array($key, $value);
}
$this->attributes['dataFields'] = $this->afExtjs->asVar("['key','value']");
$this->attributes['valueField'] = "key";
$this->attributes['displayField'] = "value";
$this->attributes['data'] = $this->afExtjs->asVar(json_encode($options));
unset($attributes['options']);
}
/**
* PROCESS selected values FROM value & selected ATTRIBUTES
* you can use either selected and/or value attributes arrays to select some values from options attribute
*/
$this->processSelectedValues($attributes);
/**
* PROCESS state ATTRIBUTE
* state can have "disabled" or "editable" values; if state is "readonly", then it's equal to "disabled"
*/
$this->processState($attributes);
parent::__construct($containerObject, $attributes);
}
示例9: end
public function end()
{
/**
* don't use the hidden attribute
*/
unset($this->attributes['hidden']);
$this->privateName = 'button_' . Util::makeRandomKey();
if (isset($this->attributes['listeners']) && count($this->attributes['listeners']) > 0) {
foreach ($this->attributes['listeners'] as $type => $type_params) {
/**
* if listener function source is not an array then the string is used directly
*/
if (isset($type_params['parameters']) && isset($type_params['source']) && !is_array($type_params['source'])) {
$this->attributes['listeners'][$type] = $this->afExtjs->asMethod(array('parameters' => $type_params['parameters'], 'source' => $type_params['source']));
}
}
}
$this->afExtjs->private[$this->privateName] = $this->afExtjs->Button($this->attributes);
return $this->privateName;
}
示例10: addCombo
public function addCombo($attributes = array())
{
$storePrivateName = 'store_' . Util::makeRandomKey();
$readerPrivateName = 'reader_' . Util::makeRandomKey();
$proxyPrivateName = 'proxy_' . Util::makeRandomKey();
$templatePrivateName = 'tpl_' . Util::makeRandomKey();
$xtemplatePrivateName = 'xtpl_' . Util::makeRandomKey();
$attributes[$readerPrivateName]['totalProperty'] = 'totalCount';
$attributes[$readerPrivateName]['root'] = 'rows';
foreach ($this->proxy['fields'] as $field) {
$attributes[$readerPrivateName]['fields'][] = $this->afExtjs->asAnonymousClass(array('name' => $field));
}
$attributes[$readerPrivateName]['fields'][] = $this->afExtjs->asAnonymousClass(array('name' => 'url'));
$this->afExtjs->private[$readerPrivateName] = $this->afExtjs->JsonReader($attributes[$readerPrivateName]);
unset($attributes[$readerPrivateName]);
$attributes[$proxyPrivateName]['url'] = $this->proxy['url'];
$this->afExtjs->private[$proxyPrivateName] = $this->afExtjs->HttpProxy($attributes[$proxyPrivateName]);
unset($attributes[$proxyPrivateName]);
$attributes[$storePrivateName]['reader'] = $this->afExtjs->asVar($readerPrivateName);
$attributes[$storePrivateName]['proxy'] = $this->afExtjs->asVar($proxyPrivateName);
$this->afExtjs->private[$storePrivateName] = $this->afExtjs->Store($attributes[$storePrivateName]);
unset($attributes[$storePrivateName]);
$this->afExtjs->private[$templatePrivateName] = '<tpl for="."><div class="search-item">' . $this->template . '</div></tpl>';
$this->afExtjs->private[$xtemplatePrivateName] = $this->afExtjs->XTemplate(array($templatePrivateName));
$attributes['typeAhead'] = false;
$attributes['loadingText'] = 'Searching...';
$attributes['width'] = '520';
$attributes['pageSize'] = $this->proxy['limit'];
$attributes['hideTrigger'] = true;
$attributes['itemSelector'] = 'div.search-item';
$attributes['tpl'] = $this->afExtjs->asVar($xtemplatePrivateName);
$attributes['store'] = $this->afExtjs->asVar($storePrivateName);
$attributes['id'] = 'center_combo';
$attributes['minChars'] = $this->proxy['minChars'];
$attributes['onSelect'] = $this->afExtjs->asMethod(array("parameters" => "record", "source" => "window.location.href=record.data.url;"));
$attributes['applyTo'] = 'search_input';
$this->afExtjs->private['combo'] = $this->afExtjs->ComboBox($attributes);
//$this->addInitMethodSource('Ext.get("center_combo").boxWrap().addClass("x-box-blue");Ext.get("center_combo").dom.parentNode.parentNode.parentNode.parentNode.parentNode.style.width="500px";Ext.get("center_combo").show();');
}
示例11: end
public function end()
{
/*$this->attributes['listeners']['afterrender']=$this->afExtjs->asMethod(array(
"parameters"=>"value, metadata, record",
"source"=>"var tb = this.getTopToolbar();
if(!tb) return;
var box = this.getBox();
tb.setWidth(box.width); "
));
*/
$this->attributes['canMask'] = $this->afExtjs->asMethod(array("parameters" => "", "source" => "return !Ext.isIE&&!" . $this->privateName . ".disableLoadMask&&!Ext.get('loading');"));
if (!$this->attributes['tree']) {
$this->attributes['view'] = $this->afExtjs->GroupingColorView(array('forceFit' => $this->attributes['forceFit'], 'groupTextTpl' => ' {text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'));
if (isset($this->attributes['clearGrouping']) && $this->attributes['clearGrouping']) {
@($this->attributes['listeners']['render']["source"] .= "this.store.clearGrouping();");
}
} else {
$this->afExtjs->setAddons(array('css' => array($this->afExtjs->getPluginsDir() . 'treegrid/css/TreeGrid.css'), 'js' => array($this->afExtjs->getPluginsDir() . 'treegrid/TreeGrid.js', $this->afExtjs->getPluginsDir() . 'treegrid/Ext.ux.SynchronousTreeExpand.js')));
$this->attributes['viewConfig'] = $this->afExtjs->asAnonymousClass(array('forceFit' => $this->attributes['forceFit']));
}
if (isset($this->proxy['url']) && count($this->columns) > 0) {
$this->proxy['url'] = sfContext::getInstance()->getRequest()->getRelativeUrlRoot() . $this->proxy['url'];
$filtersPrivateName = 'filters_' . Util::makeRandomKey();
$storePrivateName = 'store_' . Util::makeRandomKey();
$readerPrivateName = 'reader_' . Util::makeRandomKey();
if ($this->attributes['pager']) {
$pagingToolbarPrivateName = 'pt_' . Util::makeRandomKey();
}
$wasSort = false;
$firstSortableCol = null;
$summaryPlugin = false;
foreach ($this->columns as $column) {
$temp_column = null;
$temp_field = null;
$temp_name = 'Header ' . Util::makeRandomKey();
$temp_column['dataIndex'] = isset($column['name']) ? $column['name'] : Util::stripText($temp_name);
$temp_field['name'] = isset($column['name']) ? $column['name'] : Util::stripText($temp_name);
//$temp_field['type']=isset($column['type'])?$column['type']:'auto';
$temp_field['sortType'] = isset($column['sortType']) ? $column['sortType'] : 'asText';
$temp_column['sortType'] = isset($column['sortType']) ? $column['sortType'] : 'asText';
//Grid summary plugin
$temp_column['summaryType'] = isset($column['summaryType']) ? $column['summaryType'] : null;
if (!$summaryPlugin && $temp_column['summaryType'] != null) {
$this->attributes['plugins'][] = "new Ext.ux.grid.GridSummary";
$summaryPlugin = true;
}
$temp_column['header'] = isset($column['label']) ? $column['label'] : $temp_name;
$temp_column['sortable'] = isset($column['sortable']) ? $column['sortable'] : true;
if (isset($column['width']) && $column['width'] != 'auto') {
$temp_column['width'] = $column['width'];
}
$temp_column['hidden'] = isset($column['hidden']) ? $column['hidden'] : false;
$temp_column['hideable'] = isset($column['hideable']) ? $column['hideable'] : true;
$temp_column = $this->formatNumberColumn($temp_column);
/**
* Edit link at defined column
* Please comment this block if the edit should be under the Actions column.
* This section looks the edit="true" in the xml columns. If found, and if
* there is a row actions matching the name or label with edit, this will
* be transformed to the edit="true" column
*/
if (isset($column['edit']) && $column['edit'] || isset($column['action'])) {
//print_r($this->actionsObject);
if ($this->actionsObject) {
$actions = $this->actionsObject->getActions();
//print_r($actions);
if (is_array($actions)) {
foreach ($actions as $key => $action) {
if (isset($column['action']) && preg_match("/list[0-9]+_" . preg_replace("/^\\//", "", $column['action']) . "\$/", $action['name']) || isset($column['edit']) && $column['edit'] === "true" && (preg_match("/_edit\$/", $action['name']) || preg_match("/edit\$/i", $action['label']) || preg_match("/_modify\$/", $action['name']) || preg_match("/modify\$/i", $action['label']) || preg_match("/_update\$/", $action['name']) || preg_match("/update\$/i", $action['label']))) {
$urlIndex = $action['urlIndex'];
$credential = ComponentCredential::urlHasCredential($action['url']);
$actionUrl = UrlUtil::url($action['url']);
if (isset($action['load']) && $action['load'] == "page") {
$actionUrl = $action['url'];
}
$temp_column['renderer'] = $this->afExtjs->asMethod(array("parameters" => "value, metadata, record", "source" => "if(!" . intval($credential) . ") return value;var action = record.get('" . $urlIndex . "'); if(!action) return value; var m = action.toString().match(/.*?\\?(.*)/);return '<a href=\"" . $actionUrl . "?'+m[1]+'\" qtip=\"" . (isset($action['tooltip']) ? $action['tooltip'] : '') . "\">'+ value + '</a>';"));
$this->actionsObject = $this->actionsObject->changeProperty($action['name'], 'hidden', true);
if (isset(afExtjs::getInstance()->private[$this->actionsObject->privateName])) {
unset(afExtjs::getInstance()->private[$this->actionsObject->privateName]);
}
$this->actionsObject->end();
$this->movedRowActions++;
}
}
}
}
}
/*
* check for context menu
*/
$style = '';
$arrowSpan = '';
if (isset($column['contextMenu']) && $column['contextMenu']) {
$style = "";
$arrowSpan = '<span class="interactive-arrow"><a class="interactive-arrow-a" href="#"> </a></span>';
$contextMenu = context_menu($column['contextMenu'])->privateName;
$this->contextMenu[$temp_field['name']] = $contextMenu;
$temp_column['renderer'] = $this->afExtjs->asMethod(array("parameters" => "value, metadata, record", "source" => "return '<span {$style}>{$arrowSpan}' + value + '</span>';"));
}
/*else{
//.........这里部分代码省略.........
示例12: beforeEnd
public function beforeEnd()
{
if (isset($this->attributes['viewport']['center_panel']) && count($this->attributes['viewport']['center_panel']) > 0) {
$attributes = array_merge(array(), $this->attributes['viewport']['center_panel']);
}
if (isset($this->attributes['idxml'])) {
$attributes['idxml'] = $this->attributes['idxml'];
}
if (isset($this->attributes['layoutType'])) {
$attributes['layoutType'] = $this->attributes['layoutType'];
}
switch ($this->attributes['layoutType']) {
case afPortalStatePeer::TYPE_NORMAL:
if (isset($this->attributes['tools'])) {
if (!afExtjs::getInstance()->isDesktop()) {
$attributes['tools'] = $this->attributes['tools']->end();
} else {
$attributes['winTools'] = $this->attributes['tools']->end();
unset($attributes['tools']);
}
}
if (afExtjs::getInstance()->isDesktop()) {
$attributes['winTitle'] = $attributes['title'];
unset($attributes['title']);
}
if (isset($this->attributes['portalLayoutType'])) {
$attributes['portalLayoutType'] = $this->attributes['portalLayoutType'];
}
if (isset($this->attributes['portalWidgets'])) {
$attributes['portalWidgets'] = $this->attributes['portalWidgets'];
}
$attributes['autoScroll'] = true;
//$attributes['id']='center_panel_first_panel';
$attributes['border'] = false;
$attributes['bodyBorder'] = false;
/**
* fixing ticket #1295 part 2
*
* @author Radu Topala <radu@appflower.com>
*/
$attributes['dropConfig']['ddGroup'] = 'portal_' . Util::makeRandomKey() . '_dd';
$this->afExtjs->privateAttributes['container'] = $attributes;
$this->afExtjs->private['center_panel_first_panel'] = $this->afExtjs->Portal($attributes);
$attributesPanel['items'][] = $this->afExtjs->asVar('center_panel_first_panel');
$attributesPanel['border'] = true;
$attributesPanel['bodyBorder'] = true;
$attributesPanel['layout'] = 'fit';
$attributesPanel['id'] = 'center_panel_first';
$this->afExtjs->private['center_panel_first'] = $this->afExtjs->Panel($attributesPanel);
$attributesPanelContainer['items'][] = $this->afExtjs->asVar('center_panel_first');
$attributesPanelContainer['style'] = 'padding-right:5px;';
$attributesPanelContainer['border'] = false;
$attributesPanelContainer['bodyBorder'] = false;
$attributesPanelContainer['layout'] = 'fit';
$attributesPanelContainer['id'] = 'center_panel';
$this->addPanel('center', $attributesPanelContainer);
break;
case afPortalStatePeer::TYPE_TABBED:
$attributesTabPanel = array_merge($attributes, array('enableTabScroll' => true, 'deferredRender' => true, 'resizeTabs' => true, 'minTabWidth' => 115, 'tabWidth' => 135, 'frame' => false, 'collapsible' => false, 'afterLayoutOnceEvent' => false));
/**
* ticket #74, tickets.appflower.com
*
* assign activeTab to the current #<tab-name> or to first tab if no hash is added in URI
*/
$attributesTabPanel['listeners']['afterLayout'] = $this->afExtjs->asMethod(array('parameters' => 'tabPanel,layout', 'source' => "if(tabPanel.getActiveTab())tabPanel.getActiveTab().doLayout();\n\t\t\t\t \t \ttabPanel.setHeight(tabPanel.ownerCt.getInnerHeight()-1);\n\t\t\t\t \t \tif(tabPanel.afterLayoutOnceEvent==false){new Portals().onTabChange(tabPanel);}\n\t\t\t\t \t \t"));
$attributesTabPanel['listeners']['tabchange'] = $this->afExtjs->asMethod(array('parameters' => 'tabPanel,tab', 'source' => "tabPanel.doLayout();if(tabPanel.getActiveTab().items){tabPanel.getActiveTab().items.items[0].afterLayoutEvent=false;tabPanel.getActiveTab().items.items[0].onPortalAfterLayout(tabPanel.getActiveTab().items.items[0]);}afApp.changeTabHash(tab);"));
$attributesPanel['title'] = $attributesTabPanel['title'];
unset($attributesTabPanel['title']);
if (isset($this->attributes['tools'])) {
if (!afExtjs::getInstance()->isDesktop()) {
$attributesPanel['tools'] = $this->attributes['tools']->end();
} else {
$attributesTabPanel['winTools'] = $this->attributes['tools']->end();
unset($attributes['tools']);
}
}
if (afExtjs::getInstance()->isDesktop()) {
$attributesTabPanel['winTitle'] = $attributes['title'];
}
//$attributesTabPanel['id']='center_panel_first_panel';
$this->afExtjs->private['center_panel_first_panel'] = $this->afExtjs->TabPanel($attributesTabPanel);
$attributesPanel['items'][] = $this->afExtjs->asVar('center_panel_first_panel');
$attributesPanel['border'] = true;
$attributesPanel['bodyBorder'] = true;
$attributesPanel['layout'] = 'fit';
$attributesPanel['id'] = 'center_panel_first';
$this->afExtjs->privateAttributes['container'] = $attributesPanel;
$this->afExtjs->private['center_panel_first'] = $this->afExtjs->Panel($attributesPanel);
$attributesPanelContainer['items'][] = $this->afExtjs->asVar('center_panel_first');
$attributesPanelContainer['style'] = 'padding-right:5px;';
$attributesPanelContainer['border'] = false;
$attributesPanelContainer['bodyBorder'] = false;
$attributesPanelContainer['layout'] = 'fit';
$attributesPanelContainer['id'] = 'center_panel';
$this->addPanel('center', $attributesPanelContainer);
break;
}
}
示例13: __construct
public function __construct($containerObject, $attributes = array(), $parsedData = array())
{
$this->attributes['triggerAction'] = 'all';
$this->attributes['minChars'] = isset($attributes['minChars']) ? $attributes['minChars'] : 1;
$this->afExtjs = afExtjs::getInstance();
/**
* if isset button, then xtype will become combowbutton
*/
if (isset($attributes['button'])) {
$this->attributes['buttonConfig'] = $attributes['button'];
$this->attributes['xtype'] = 'combowbutton';
unset($attributes['button']);
if (isset($attributes['window'])) {
// if(isset($attributes['window']['component'])&&is_object($attributes['window']['component']))
// {
// $this->attributes['windowConfig']['items'][]=$attributes['window']['component']->privateName;
//
//
//
// unset($attributes['window']['component']);
// }
$this->attributes['windowConfig'] = array_merge(isset($this->attributes['windowConfig']) ? $this->attributes['windowConfig'] : array(), $attributes['window']);
unset($attributes['window']);
}
$this->attributes['width'] = '250';
if (empty($attributes['options'])) {
$this->attributes['store'] = '[[0,"No options available.."]]';
}
} else {
$this->afExtjs->setAddons(array('js' => array($this->afExtjs->getPluginsDir() . 'form/Ext.ux.form.Combo.js')));
$this->attributes['xtype'] = 'combowcolors';
if (isset($attributes['proxy']) && isset($attributes['template'])) {
/**
* autocomplete combo config
*/
$storePrivateName = 'store_' . Util::makeRandomKey();
$readerPrivateName = 'reader_' . Util::makeRandomKey();
$proxyPrivateName = 'proxy_' . Util::makeRandomKey();
$templatePrivateName = 'tpl_' . Util::makeRandomKey();
$xtemplatePrivateName = 'xtpl_' . Util::makeRandomKey();
$attributes[$readerPrivateName]['totalProperty'] = 'totalCount';
$attributes[$readerPrivateName]['root'] = 'rows';
foreach ($attributes['proxy']['fields'] as $field) {
$attributes[$readerPrivateName]['fields'][] = $this->afExtjs->asAnonymousClass(array('name' => $field));
}
$attributes[$readerPrivateName]['fields'][] = $this->afExtjs->asAnonymousClass(array('name' => 'url'));
$this->afExtjs->private[$readerPrivateName] = $this->afExtjs->JsonReader($attributes[$readerPrivateName]);
unset($attributes[$readerPrivateName]);
$attributes[$proxyPrivateName]['url'] = $attributes['proxy']['url'];
$this->afExtjs->private[$proxyPrivateName] = $this->afExtjs->HttpProxy($attributes[$proxyPrivateName]);
unset($attributes[$proxyPrivateName]);
$attributes[$storePrivateName]['reader'] = $this->afExtjs->asVar($readerPrivateName);
$attributes[$storePrivateName]['proxy'] = $this->afExtjs->asVar($proxyPrivateName);
$this->afExtjs->private[$storePrivateName] = $this->afExtjs->Store($attributes[$storePrivateName]);
unset($attributes[$storePrivateName]);
$this->afExtjs->private[$templatePrivateName] = '<tpl for="."><div class="search-item">' . $attributes['template'] . '</div></tpl>';
$this->afExtjs->private[$xtemplatePrivateName] = $this->afExtjs->XTemplate(array($this->afExtjs->asVar($templatePrivateName)));
$this->attributes['typeAhead'] = false;
$this->attributes['loadingText'] = 'Searching...';
$this->attributes['width'] = '250';
$this->attributes['pageSize'] = $attributes['proxy']['limit'];
$this->attributes['hideTrigger'] = true;
$this->attributes['itemSelector'] = 'div.search-item';
$this->attributes['tpl'] = $this->afExtjs->asVar($xtemplatePrivateName);
$this->attributes['store'] = $this->afExtjs->asVar($storePrivateName);
$this->attributes['minChars'] = $attributes['proxy']['minChars'];
if (isset($attributes['proxy']['selectedIndex'])) {
$this->attributes['onSelect'] = $this->afExtjs->asMethod(array("parameters" => "record", "source" => "if(record.data." . $attributes['proxy']['selectedIndex'] . "){var selectedValue=record.data." . $attributes['proxy']['selectedIndex'] . ";this.setRawValue(record.data." . $attributes['proxy']['selectedIndex'] . ");this.setValue(record.data." . $attributes['proxy']['selectedIndex'] . ");this.collapse();}"));
}
unset($attributes['proxy']);
unset($attributes['template']);
} else {
/**
* normal combo config
*/
$this->attributes['forceSelection'] = true;
$this->attributes['disableKeyFilter'] = true;
$this->attributes['mode'] = 'local';
$this->attributes['triggerAction'] = 'all';
$this->attributes['width'] = '250';
}
}
/**
* the options attribute, an assoc array for now
*/
if (isset($attributes['options']) && count($attributes['options']) > 0 && (!isset($attributes['plugin']) || isset($attributes['plugin']) && $attributes['plugin'] != 'autocompleter')) {
$options = array();
foreach ($attributes['options'] as $key => $value) {
$tarray = null;
$tarray[] = $key;
if (is_array($value)) {
foreach ($value as $k => $v) {
$tarray[] = $v;
}
} else {
$tarray[] = $value;
$tarray[] = '#FFFFFF';
}
$options[] = $tarray;
}
//.........这里部分代码省略.........
示例14: __construct
public function __construct($containerObject, $attributes = array())
{
$this->afExtjs = afExtjs::getInstance();
if ($this->privateName == null) {
$this->privateName = 'field_' . Util::makeRandomKey();
}
if (isset($attributes['break'])) {
unset($attributes['break']);
}
$this->containerObject = $containerObject;
$this->afExtjs->setAddons(array('js' => array($this->afExtjs->getPluginsDir() . 'form/Ext.ux.plugins.HelpText.js')));
$this->attributes['plugins'][] = "Ext.ux.plugins.HelpText";
if (@$attributes['vtype']) {
$this->attributes['vtype'] = $attributes['vtype'];
}
//$this->attributes['labelStyle']='width:100px;font-size:11px;font-weight:bold;padding:0 3px 3px 0;';
if (isset($attributes['state'])) {
switch ($attributes['state']) {
case "readonly":
$this->attributes['readOnly'] = true;
break;
case "disabled":
$this->attributes['disabled'] = true;
break;
case "editable":
$this->attributes['disabled'] = false;
$this->attributes['readOnly'] = false;
break;
}
unset($attributes['state']);
}
if (isset($attributes['name'])) {
$this->attributes['name'] = $attributes['name'];
}
if (isset($attributes['label'])) {
$this->attributes['fieldLabel'] = $attributes['label'];
unset($attributes['label']);
}
if (isset($attributes['value']) && $attributes['value'] != null) {
$this->attributes['value'] = $attributes['value'];
unset($attributes['value']);
}
if (isset($attributes['handlers']) && $attributes['handlers'] != '') {
if (isset($this->attributes['listeners'])) {
foreach ($this->attributes['listeners'] as $type => $type_params) {
/**
* if listener function source is not an array then the string is used directly
*/
if (isset($type_params['parameters']) && $type_params['parameters'] != '' && isset($type_params['source']) && !is_array($type_params['source'])) {
$this->attributes['listeners'][$type] = array('parameters' => $type_params['parameters'], 'source' => $type_params['source'] . (isset($attributes['handlers'][$type]) ? $attributes['handlers'][$type]['source'] : ""));
}
}
} else {
$this->attributes['listeners'] = $attributes['handlers'];
}
unset($attributes['handlers']);
}
if (isset($attributes['help']) && $attributes['help'] != '') {
if (!isset($this->attributes['listeners']['render']['source'])) {
$this->attributes['listeners']['render']['source'] = '';
}
if (!isset($this->attributes['listeners']['render']['parameters'])) {
$this->attributes['listeners']['render']['parameters'] = 'field';
}
$this->attributes['listeners']['render']['source'] .= "new Ext.ToolTip({target: field.getEl(),html: '" . $attributes['help'] . "'});";
unset($attributes['help']);
}
/**
* TYPES:
* comment || inline
*/
$this->attributes['helpType'] = isset($attributes['helpType']) ? $attributes['helpType'] : 'comment';
if (isset($attributes['comment']) && $attributes['comment'] != '') {
$this->attributes['helpText'] = '<i>' . $attributes['comment'] . '</i>';
unset($attributes['comment']);
}
if (count($attributes) > 0) {
$this->attributes = array_merge($this->attributes, $attributes);
}
//process the field and attach it to the current containerObject
$this->end();
}
示例15: processFileFields
/**
* File fields processing
*
* @example <i:field label="File" name="file" type="file">
* <i:value type="orm">
* <i:class>ModelCriteriaFetcher</i:class>
* <i:method name="configureFileField">
* <i:param name="fields">[path:file_path_field]</i:param>
* </i:method>
* </i:value>
* </i:field>
*
* if multiple files for table should be added <i:param name="glue_model">ForeignModelName</i:param>
*
* @param BaseObject $model
* @return void
* @author Sergey Startsev
*/
public function processFileFields(BaseObject $model)
{
$model_name = $this->object->getPeer()->getOMClass(false);
$upload_dir = sfConfig::get('sf_upload_dir');
$web_upload_dir = str_replace(sfConfig::get('sf_web_dir'), '', $upload_dir);
if (!file_exists($upload_dir)) {
mkdir($upload_dir);
}
foreach ($this->dom_xml_xpath->query('//i:fields/i:field[@type="file"]') as $field) {
$name = $field->getAttribute('name');
$params = array();
$class = $field->getElementsByTagName('class');
$method = $field->getElementsByTagName('method');
if (!$class || !$method) {
continue;
}
$classNode = $class->item(0);
$methodNode = $method->item(0);
if ($classNode->nodeValue != 'ModelCriteriaFetcher' || $methodNode->getAttribute('name') != 'configureFileField') {
continue;
}
foreach ($methodNode->getElementsByTagName('param') as $param) {
$params[$param->getAttribute('name')] = $param->nodeValue;
}
$is_foreign = false;
$hashes = array();
if (!array_key_exists('fields', $params)) {
continue;
}
foreach (explode(',', str_replace(array('[', ']'), '', $params['fields'])) as $def) {
list($key, $value) = explode(':', $def);
$hashes[$key] = $value;
}
if (array_key_exists('glue_model', $params)) {
$glue_model = $params['glue_model'];
$is_foreign = true;
}
if (array_key_exists('upload_dir', $params)) {
$web_upload_dir = '/' . trim($params['upload_dir'], '/');
$upload_dir = sfConfig::get('sf_web_dir') . $web_upload_dir;
if (!file_exists($upload_dir)) {
@mkdir($upload_dir, 0775, true);
}
}
if (!isset($_FILES['edit']['name']['0'][$name]) || !$_FILES['edit']['size']['0'][$name]) {
continue;
}
$file_native_name = $_FILES['edit']['name']['0'][$name];
$file_size = $_FILES['edit']['size']['0'][$name];
$file_name = Util::makeRandomKey() . '.' . pathinfo($file_native_name, PATHINFO_EXTENSION);
$file_path = "{$upload_dir}/{$file_name}";
$tmp_name = $_FILES['edit']['tmp_name']['0'][$name];
if (!move_uploaded_file($tmp_name, $file_path)) {
continue;
}
if ($is_foreign) {
$glue = new $glue_model();
call_user_func(array($glue, "set" . get_class($model)), $model);
} else {
$glue = $model;
}
if (array_key_exists('path', $hashes)) {
$glue->setByName($hashes['path'], "{$web_upload_dir}/{$file_name}", BasePeer::TYPE_FIELDNAME);
}
if (array_key_exists('original_name', $hashes)) {
$glue->setByName($hashes['original_name'], $file_native_name, BasePeer::TYPE_FIELDNAME);
}
if (array_key_exists('name', $hashes)) {
$glue->setByName($hashes['name'], $file_name, BasePeer::TYPE_FIELDNAME);
}
if (array_key_exists('size', $hashes)) {
$glue->setByName($hashes['size'], $file_size, BasePeer::TYPE_FIELDNAME);
}
$glue->save();
}
}