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


PHP Jtext::script方法代码示例

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


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

示例1: _addJavascript

 /**
  * append the form javascript into the document head
  * @param int table id
  */
 protected function _addJavascript($tableId)
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $model = $this->getModel();
     $aLoadedElementPlugins = array();
     $jsActions = array();
     $jsControllerKey = $model->_editable ? 'form_' . $model->getId() : 'details_' . $model->getId();
     if (!defined('_JOS_FABRIK_FORMJS_INCLUDED')) {
         define('_JOS_FABRIK_FORMJS_INCLUDED', 1);
         FabrikHelperHTML::slimbox();
         $srcs = array('media/com_fabrik/js/form.js', 'media/com_fabrik/js/element.js');
     }
     $aWYSIWYGNames = array();
     // $$$ hugh - yeat another one where if we =&, the $groups array pointer get buggered up and it
     // skips a group
     $groups = $model->getGroupsHiarachy();
     foreach ($groups as $groupModel) {
         $elementModels = $groupModel->getPublishedElements();
         foreach ($elementModels as $elementModel) {
             $res = $elementModel->useEditor();
             if ($res !== false) {
                 $aWYSIWYGNames[] = $res;
             }
             $eparams = $elementModel->getParams();
             //load in once the element js class files
             // $$$ hugh - only needed getParent when we weren't saving changes to parent params to child
             // which we should now be doing ... and getParent() causes an extra table lookup for every child
             // element on the form.
             //$element =& $elementModel->getParent();
             $element = $elementModel->getElement();
             if (!in_array($element->plugin, $aLoadedElementPlugins)) {
                 $aLoadedElementPlugins[] = $element->plugin;
                 $elementModel->formJavascriptClass($srcs);
             }
             $eventMax = $groupModel->_repeatTotal == 0 ? 1 : $groupModel->_repeatTotal;
             for ($c = 0; $c < $eventMax; $c++) {
                 $jsActions[] = $elementModel->getFormattedJSActions($jsControllerKey, $c);
             }
         }
     }
     FabrikHelperHTML::script($srcs, true);
     //new
     $actions = trim(implode("\n", $jsActions));
     //end new
     $params = $model->getParams();
     $listModel = $model->getlistModel();
     $table = $listModel->getTable();
     $form = $model->getForm();
     FabrikHelperHTML::mocha();
     $bkey = $model->_editable ? 'form_' . $model->getId() : 'details_' . $model->getId();
     FabrikHelperHTML::tips('.hasTip', array(), "\$('{$bkey}')");
     $key = FabrikString::safeColNameToArrayKey($table->db_primary_key);
     $this->get('FormCss');
     $this->get('CustomJsAction');
     $startJs = "head.ready(function() {\n";
     $endJs = "});\n";
     $start_page = isset($model->sessionModel->last_page) ? (int) $model->sessionModel->last_page : 0;
     if ($start_page !== 0) {
         $app->enqueueMessage(JText::_('COM_FABRIK_RESTARTING_MUTLIPAGE_FORM'));
     } else {
         // form submitted but fails validation - needs to go to the last page
         $start_page = JRequest::getInt('currentPage', 0);
     }
     $opts = new stdClass();
     $opts->admin = $app->isAdmin();
     $opts->ajax = $model->isAjax();
     $opts->ajaxValidation = $params->get('ajax_validations');
     $opts->primaryKey = $key;
     $opts->error = @$form->origerror;
     $opts->pages = $model->getPages();
     $opts->plugins = array();
     $opts->multipage_save = (bool) $model->saveMultiPage();
     $opts->editable = $model->_editable;
     $opts->start_page = $start_page;
     $opts->inlineMessage = (bool) $this->isMambot;
     //$$$rob dont int this as keys may be string
     $opts->rowid = $model->_rowId;
     //3.0 needed for ajax requests
     $opts->listid = (int) $this->get('ListModel')->getId();
     $imgs = new stdClass();
     $imgs->alert = FabrikHelperHTML::image('alert.png', 'form', $this->tmpl, '', true);
     $imgs->action_check = FabrikHelperHTML::image('action_check.png', 'form', $this->tmpl, '', true);
     $imgs->ajax_loader = FabrikHelperHTML::image('ajax-loader.gif', 'form', $this->tmpl, '', true);
     $opts->images = $imgs;
     //$$$rob if you are loading a table in a window from a form db join select record option
     // then we want to know the id of the window so we can set its showSpinner() method
     $opts->fabrik_window_id = JRequest::getVar('fabrik_window_id', '');
     //3.0 changed to fabrik_window_id (automatically appended by Fabrik.Window xhr request to load window data
     //for editing groups with joined data and an empty joined record (ie no joined records)
     $hidden = array();
     $maxRepeat = array();
     foreach ($this->groups as $g) {
         $hidden[$g->id] = $g->startHidden;
         $maxRepeat[$g->id] = $g->maxRepeat;
     }
//.........这里部分代码省略.........
开发者ID:juliano-hallac,项目名称:fabrik,代码行数:101,代码来源:view.html.php

示例2: _addJavascript

 /**
  * Append the form javascript into the document head
  *
  * @param   int  $tableId  table id
  *
  * @return  void
  */
 protected function _addJavascript($tableId)
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $model = $this->getModel();
     $aLoadedElementPlugins = array();
     $jsActions = array();
     $jsControllerKey = $model->isEditable() ? 'form_' . $model->getId() : 'details_' . $model->getId();
     $srcs = FabrikHelperHTML::framework();
     if (!defined('_JOS_FABRIK_FORMJS_INCLUDED')) {
         define('_JOS_FABRIK_FORMJS_INCLUDED', 1);
         FabrikHelperHTML::slimbox();
         $srcs[] = 'media/com_fabrik/js/form.js';
         $srcs[] = 'media/com_fabrik/js/element.js';
         $srcs[] = 'media/com_fabrik/js/lib/form_placeholder/Form.Placeholder.js';
     }
     $aWYSIWYGNames = array();
     // $$$ hugh - yeat another one where if we =, the $groups array pointer get buggered up and it
     // skips a group
     $groups = $model->getGroupsHiarachy();
     foreach ($groups as $groupModel) {
         $elementModels = $groupModel->getPublishedElements();
         foreach ($elementModels as $elementModel) {
             $res = $elementModel->useEditor();
             if ($res !== false) {
                 $aWYSIWYGNames[] = $res;
             }
             $eparams = $elementModel->getParams();
             /* load in once the element js class files
              * $$$ hugh - only needed getParent when we weren't saving changes to parent params to child
              * which we should now be doing ... and getParent() causes an extra table lookup for every child
              * element on the form.
              * $element = $elementModel->getParent();
              */
             $element = $elementModel->getElement();
             if (!in_array($element->plugin, $aLoadedElementPlugins)) {
                 /* $$$ hugh - certain elements, like fileupload, need to load different JS files
                  * on a per-element basis, so as a test fix, I modified the fileupload's formJavaScriptClass to return false,
                  * and test for that here, so as to not add it to aLoadedElementPlugins[].  The existing 'static' tests in
                  * formJavascriptClass() should still prevent scripts being added twice.
                  */
                 if ($elementModel->formJavascriptClass($srcs) !== false) {
                     $aLoadedElementPlugins[] = $element->plugin;
                 }
             }
             $eventMax = $groupModel->repeatTotal == 0 ? 1 : $groupModel->repeatTotal;
             for ($c = 0; $c < $eventMax; $c++) {
                 $jsActions[] = $elementModel->getFormattedJSActions($jsControllerKey, $c);
             }
         }
     }
     $actions = trim(implode("\n", $jsActions));
     $params = $model->getParams();
     $listModel = $model->getlistModel();
     $table = $listModel->getTable();
     $form = $model->getForm();
     FabrikHelperHTML::mocha();
     $bkey = $model->isEditable() ? 'form_' . $model->getId() : 'details_' . $model->getId();
     FabrikHelperHTML::tips('.hasTip', array(), "\$('{$bkey}')");
     $key = FabrikString::safeColNameToArrayKey($table->db_primary_key);
     $this->get('FormCss');
     $start_page = isset($model->sessionModel->last_page) ? (int) $model->sessionModel->last_page : 0;
     if ($start_page !== 0) {
         $app->enqueueMessage(JText::_('COM_FABRIK_RESTARTING_MUTLIPAGE_FORM'));
     } else {
         // Form submitted but fails validation - needs to go to the last page
         $start_page = JRequest::getInt('currentPage', 0);
     }
     $opts = new stdClass();
     $opts->admin = $app->isAdmin();
     $opts->ajax = $model->isAjax();
     $opts->ajaxValidation = (bool) $params->get('ajax_validations');
     $opts->primaryKey = $key;
     $opts->error = @$form->origerror;
     $opts->pages = $model->getPages();
     $opts->plugins = array();
     $opts->multipage_save = (int) $model->saveMultiPage();
     $opts->editable = $model->isEditable();
     $opts->start_page = $start_page;
     $opts->inlineMessage = (bool) $this->isMambot;
     // $$$rob dont int this as keys may be string
     $opts->rowid = (string) $model->_rowId;
     // 3.0 needed for ajax requests
     $opts->listid = (int) $this->get('ListModel')->getId();
     $imgs = new stdClass();
     $imgs->alert = FabrikHelperHTML::image('alert.png', 'form', $this->tmpl, '', true);
     $imgs->action_check = FabrikHelperHTML::image('action_check.png', 'form', $this->tmpl, '', true);
     $imgs->ajax_loader = FabrikHelperHTML::image('ajax-loader.gif', 'form', $this->tmpl, '', true);
     $opts->images = $imgs;
     // $$$rob if you are loading a table in a window from a form db join select record option
     // then we want to know the id of the window so we can set its showSpinner() method
     // 3.0 changed to fabrik_window_id (automatically appended by Fabrik.Window xhr request to load window data
     $opts->fabrik_window_id = JRequest::getVar('fabrik_window_id', '');
//.........这里部分代码省略.........
开发者ID:rogeriocc,项目名称:fabrik,代码行数:101,代码来源:view.base.php


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