本文整理汇总了PHP中Zend_View::inlineScript方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View::inlineScript方法的具体用法?PHP Zend_View::inlineScript怎么用?PHP Zend_View::inlineScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View
的用法示例。
在下文中一共展示了Zend_View::inlineScript方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addFormElements
/**
* Adds elements from the model to the bridge that creates the form.
*
* @param \MUtil_Model_Bridge_FormBridgeInterface $bridge
* @param \MUtil_Model_ModelAbstract $model
*/
protected function addFormElements(\MUtil_Model_Bridge_FormBridgeInterface $bridge, \MUtil_Model_ModelAbstract $model)
{
$this->mailElements->setForm($bridge->getForm());
$this->initItems();
$this->addItems($bridge, 'gct_name');
$this->addItems($bridge, 'gct_id_template', 'gct_target');
$this->addItems($bridge, 'gct_code');
$bridge->getForm()->getElement('gct_target')->setAttrib('onchange', 'this.form.submit()');
$defaultTab = $this->project->getLocaleDefault();
$this->mailElements->addFormTabs($bridge, 'gctt', 'active', $defaultTab, 'tabcolumn', 'gctt_lang', 'selectedTabElement', 'send_language');
$config = array('extraPlugins' => 'bbcode,availablefields', 'toolbar' => array(array('Source', '-', 'Undo', 'Redo'), array('Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'), array('Link', 'Unlink', 'Image', 'SpecialChar'), '/', array('Bold', 'Italic', 'Underline'), array('NumberedList', 'BulletedList', '-', 'Blockquote'), array('Maximize'), array('availablefields')));
$mailfields = $this->mailer->getMailFields();
foreach ($mailfields as $field => $value) {
$mailfields[$field] = utf8_encode($value);
}
$config['availablefields'] = $mailfields;
$config['availablefieldsLabel'] = $this->_('Fields');
$this->view->inlineScript()->prependScript("\n CKEditorConfig = " . \Zend_Json::encode($config) . ";\n ");
$bridge->addFakeSubmit('preview', array('label' => $this->_('Preview')));
$bridge->addElement($this->mailElements->createEmailElement('to', $this->_('To (test)'), false));
$bridge->addElement($this->mailElements->createEmailElement('from', $this->_('From'), false));
//$bridge->addRadio('send_language', array('label' => $this->_('Test language'), 'multiOptions' => ))
$bridge->addHidden('send_language');
$bridge->addFakeSubmit('sendtest', array('label' => $this->_('Send (test)')));
$bridge->addElement($this->getSaveButton($bridge->getForm()));
$bridge->addElement($this->mailElements->createPreviewHtmlElement('Preview HTML'));
$bridge->addElement($this->mailElements->createPreviewTextElement('Preview Text'));
$bridge->addHtml('available_fields', array('label' => $this->_('Available fields')));
}
示例2: init
/**
* Initializes the application with global standards for the view
*
* @access public
* @return void
*/
public function init()
{
//$seconds = 60 * 60 * 24 * 1; // 1 day
//Zend_Session::RememberMe($seconds);
$appName = Zend_Registry::get('appName');
$moduleName = $this->getRequest()->getModuleName();
$controllerName = $this->getRequest()->getControllerName();
$actionName = $this->getRequest()->getActionName();
$controller = $this->getActionController();
$view = new Zend_View();
$auth = App_Auth::getInstance();
if ($auth->hasIdentity()) {
$identity = $auth->getIdentity();
Zend_Layout::getMvcInstance()->assign('user_name', $auth->getUserName());
}
if ($auth->hasIdentity()) {
$identity = $auth->getIdentity();
Zend_Layout::getMvcInstance()->assign('user_role', $auth->getRoleId());
}
/* if ($auth->hasIdentity()) {
$identity = $auth->getIdentity();
if ($identity->role_id == 2 && $controllerName != 'accounts' && $controllerName != 'error' && $controllerName != 'index') {
$accounts = new Application_Model_Accounts();
$select = $accounts->select()->where("user_id=" . $identity->id);
$result = $accounts->fetchRow($select);
if (count($result) == 0) {
$this->getResponse()->setRedirect('/accounts/create');
}
}
} */
/* if ($_SERVER['REQUEST_URI'] == '/index/login' || $_SERVER['REQUEST_URI'] == '/index/login/') {
$this->getResponse()->setRedirect('/login');
} */
$baseUrl = Zend_Registry::get('baseurl');
//echo $_SERVER['REQUEST_URI'];
if ($controllerName != 'index' && $moduleName != 'api' && $controllerName != 'error' && !$auth->hasIdentity()) {
$this->getResponse()->setRedirect($baseUrl . '/index?referrer=' . base64_encode(str_replace("/vlmisr2/", "", $_SERVER['REQUEST_URI'])));
}
if ($moduleName == 'cadmin' && !$auth->hasIdentity()) {
$this->getResponse()->setRedirect($baseUrl . '/index?referrer=' . base64_encode(str_replace("/vlmisr2/", "", $_SERVER['REQUEST_URI'])));
}
if ($moduleName == 'iadmin' && !$auth->hasIdentity()) {
$this->getResponse()->setRedirect($baseUrl . '/index?referrer=' . base64_encode(str_replace("/vlmisr2/", "", $_SERVER['REQUEST_URI'])));
}
if ($moduleName == 'campaign' && !$auth->hasIdentity()) {
$this->getResponse()->setRedirect($baseUrl . '/campaign/manage-campaigns?referrer=' . base64_encode(str_replace("/vlmisr2/", "", $_SERVER['REQUEST_URI'])));
}
//$view->headScript()->appendFile($baseUrl . '/js/braintree.js');
//$view->headLink()->appendStylesheet($baseUrl . '/css/main.css');
Zend_Registry::set('controller', $controllerName);
Zend_Registry::set('action', $actionName);
//Get the scripts and css directories
$scripts = empty($moduleName) ? new App_Directory('js/' . $controllerName) : new App_Directory('js/' . $moduleName . '/' . $controllerName);
$css = empty($moduleName) ? new App_Directory('css/' . $controllerName) : new App_Directory('css/' . $moduleName . '/' . $controllerName);
//Append the scripts (if any) that pertain to this action and controller
if ($scripts->exists()) {
$scripts = $scripts->getFiles();
foreach ($scripts as $script) {
if ($script === $actionName . ".js") {
if (empty($moduleName)) {
$view->inlineScript()->appendFile($baseUrl . '/js/' . $controllerName . '/' . $script);
} else {
$view->inlineScript()->appendFile($baseUrl . '/js/' . $moduleName . '/' . $controllerName . '/' . $script);
}
}
}
}
//Append the stylesheets (if any) that pertain to this action and controller
if ($css->exists()) {
$css = $css->getFiles();
foreach ($css as $stylesheet) {
if ($stylesheet === $actionName . ".css") {
if (empty($moduleName)) {
$view->headLink()->appendStylesheet($baseUrl . '/css/' . $controllerName . '/' . $stylesheet);
} else {
$view->headLink()->appendStylesheet($baseUrl . '/css/' . $moduleName . '/' . $controllerName . '/' . $stylesheet);
}
}
}
}
$appName = Zend_Registry::get('appName');
$view->inlineScript()->prependScript('var appName = "' . $appName . '"');
$view->prefix = $this->getRequest()->isXmlHttpRequest() || $this->getRequest()->getParam('ajax') == 'true' ? 'ajax' : 'page';
$view->action = $actionName;
$view->controller = $controllerName;
if ($moduleName == 'default') {
Zend_Registry::set('resource', $controllerName . "/" . $actionName);
} else {
Zend_Registry::set('resource', $moduleName . "/" . $controllerName . "/" . $actionName);
}
$arr_data = App_Controller_Functions::getPageTitleAndMeta(Zend_Registry::get('resource'));
Zend_Registry::set('pageTitle', $arr_data['pageTitle']);
Zend_Registry::set('metaTitle', $arr_data['metaTitle']);
//.........这里部分代码省略.........