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


PHP CopixTpl::getAssigned方法代码示例

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


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

示例1: _processResult

 /**
  * Réalise les derniers traitements (généralement d'affichage ou de redirection).
  *
  * En fonction du code retour de l'action CopixActionReturn::CONST, Copix réalise
  * un certain nombre de traitements pour terminer la requête en cours.
  *
  * @param	CopixActionReturn      $pToProcess   Ce qui a été retourné par CopixActionGroup::process ()
  * @see CopixActionGroup
  */
 protected function _processResult($toProcess)
 {
     $config = CopixConfig::instance();
     //appel les plugins de post-processing.
     foreach (CopixPluginRegistry::getRegistered() as $name => $plugin) {
         $plugin->afterProcess($toProcess);
     }
     //Analyse du résultat du process
     switch ($toProcess->code) {
         case CopixActionReturn::ERROR:
             //erreur
             header("Content-Type: text/html");
             $tpl = new CopixTpl();
             if (($assignedTitlePage = $tpl->getAssigned('TITLE_PAGE')) !== null) {
                 $tpl->assign('TITLE_PAGE', '[' . _i18n('copix:common.messages.error') . ']' . $assignedTitlePage);
             } else {
                 $tpl->assign('TITLE_PAGE', '[' . _i18n('copix:common.messages.error') . ']');
             }
             $this->_processStandard($tpl);
             $tpl->assign('HTML_HEAD', '<$HTML_HEAD />');
             $tpl->assign('MAIN', $toProcess->data);
             $content = $tpl->fetch('|error.tpl');
             CopixContext::clear();
             $this->_beforeDisplay($content);
             echo $content;
             break;
         case CopixActionReturn::DISPLAY:
             $charset = CopixI18N::getCharset();
             header("Content-Type: text/html;charset=" . $charset);
             $this->_processStandard($toProcess->data);
             //appel de la méthode de préparation de la page standard.
             $toProcess->data->assign('HTML_HEAD', '<$HTML_HEAD />');
             //Par ex, bandeaux de pub, menus dynamiques, ... (propres aux projets.)
             CopixContext::clear();
             $content = $toProcess->data->fetch($config->mainTemplate);
             $this->_beforeDisplay($content);
             echo $content;
             break;
         case CopixActionReturn::DISPLAY_IN:
             $charset = CopixI18N::getCharset();
             header("Content-Type: text/html;charset=" . $charset);
             $this->_processStandard($toProcess->data);
             //appel de la méthode de préparation de la page standard.
             $toProcess->data->assign('HTML_HEAD', '<$HTML_HEAD />');
             //Par ex, bandeaux de pub, menus dynamiques, ... (propres aux projets.)
             $content = $toProcess->data->fetch($toProcess->more);
             $this->_beforeDisplay($content);
             echo $content;
             break;
         case CopixActionReturn::FILE:
         case CopixActionReturn::CONTENT:
             $contentDisposition = 'inline';
             $contentTransfertEnconding = 'binary';
             $contentType = null;
             $fileNameOnly = null;
             if ($toProcess->code == CopixActionReturn::FILE) {
                 $fileName = $toProcess->data;
                 $fileNameOnly = explode('/', str_replace('\\', '/', $fileName));
                 $fileNameOnly = $fileNameOnly[count($fileNameOnly) - 1];
             }
             if (is_array($toProcess->more)) {
                 if (isset($toProcess->more['content-disposition'])) {
                     $contentDisposition = $toProcess->more['content-disposition'];
                 }
                 if (isset($toProcess->more['filename'])) {
                     $fileNameOnly = $toProcess->more['filename'];
                 }
                 if (isset($toProcess->more['content-type'])) {
                     $contentType = $toProcess->more['content-type'];
                 }
                 if (isset($toProcess->more['content-transfer-encoding'])) {
                     $contentTransfertEnconding = $toProcess->more['content-transfer-encoding'];
                 }
             } elseif (strlen(trim($toProcess->more))) {
                 $contentType = $toProcess->more;
             }
             if ($contentType === null) {
                 $contentType = CopixMIMETypes::getFromFileName($fileNameOnly);
             }
             header("Pragma: public");
             header("Expires: 0");
             header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
             header("Cache-Control: protected", false);
             header("Content-Type: " . $contentType);
             header("Content-Disposition: " . $contentDisposition . "; filename=\"" . $fileNameOnly . "\";");
             header("Content-Transfer-Encoding: " . $contentTransfertEnconding);
             header("Content-Length: " . ($toProcess->code == CopixActionReturn::FILE ? filesize($fileName) : strlen($toProcess->data)));
             if ($toProcess->code == CopixActionReturn::FILE) {
                 readfile($fileName);
             } else {
                 echo $toProcess->data;
//.........这里部分代码省略.........
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:101,代码来源:CopixController.class.php

示例2: switch

 /**
  * Agit selon le résultat de l'execution de l'action de la méthode de l'objet ActionGroup
  * Methode qui va effectuer un affichage de template, une redirection etc... en fonction
  * du code indiqué par le CopixActionReturn.
  * @param CopixActionReturn      $ToProcess   indique le type de resultat
  * @see CopixActionGroup
  * @todo rajouter une sorte de "Fin de traitement" _DoEnd / _DoFirst
  * @access private
  */
 function _processResult($toProcess)
 {
     //ending
     switch ($toProcess->code) {
         case COPIX_AR_ERROR:
             //erreur
             header("Content-Type: text/html");
             $tpl = new CopixTpl();
             if (($assignedTitlePage = $tpl->getAssigned('TITLE_PAGE')) !== null) {
                 $tpl->assign('TITLE_PAGE', '[' . CopixI18N::get('copix:common.messages.error') . ']' . $assignedTitlePage);
             } else {
                 $tpl->assign('TITLE_PAGE', '[' . CopixI18N::get('copix:common.messages.error') . ']');
             }
             $this->_processStandard($tpl);
             $this->_doHTMLHeaders($tpl);
             $tpl->assign('MAIN', $toProcess->data);
             $content = $tpl->fetch('|error.tpl');
             CopixContext::clear();
             $this->_callPluginsMethod_beforeDisplay($content);
             echo $content;
             break;
         case COPIX_AR_DISPLAY:
             header("Content-Type: text/html");
             $this->_processStandard($toProcess->data);
             //appel de la méthode de préparation de la page standard.
             $this->_doHTMLHeaders($toProcess->data);
             //Par ex, bandeaux de pub, menus dynamiques, ... (propres aux projets.)
             CopixContext::clear();
             $content = $toProcess->data->fetch($GLOBALS['COPIX']['CONFIG']->mainTemplate);
             //$content = str_replace ('./', $GLOBALS['COPIX']['CONFIG']->significant_url_basepath, $content);
             $this->_callPluginsMethod_beforeDisplay($content);
             echo $content;
             break;
         case COPIX_AR_DISPLAY_IN:
             $this->_processStandard($toProcess->data);
             //appel de la méthode de préparation de la page standard.
             $this->_doHTMLHeaders($toProcess->data);
             //Par ex, bandeaux de pub, menus dynamiques, ... (propres aux projets.)
             $content = $toProcess->data->fetch($toProcess->more);
             $this->_callPluginsMethod_beforeDisplay($content);
             echo $content;
             break;
         case COPIX_AR_REDIRECT:
             //redirection standard, message http.
             header('location: ' . $toProcess->data);
             break;
         case COPIX_AR_STATIC:
             $tpl =& new CopixTpl();
             $tpl->assign('MAIN', $this->includeStatic($toProcess->data));
             $this->_processStandard($tpl);
             $this->_doHTMLHeaders($tpl);
             $waitForMore = array('TITLE_PAGE', 'TITLE_BAR');
             foreach ($waitForMore as $key) {
                 if (isset($toProcess->more[$key])) {
                     $tpl->assign($key, $toProcess->more[$key]);
                 }
             }
             //Affichage dans le template principal.
             CopixContext::clear();
             $content = $tpl->fetch($GLOBALS['COPIX']['CONFIG']->mainTemplate);
             $this->_callPluginsMethod_beforeDisplay($content);
             echo $content;
             break;
         case COPIX_AR_DOWNLOAD:
             $fileName = $toProcess->data;
             if (is_readable($fileName) && is_file($fileName)) {
                 //quick and dirty..... still.
                 if (strlen(trim($toProcess->more))) {
                     $fileNameOnly = $toProcess->more;
                 } else {
                     $fileNameOnly = explode('/', str_replace('\\', '/', $fileName));
                     $fileNameOnly = $fileNameOnly[count($fileNameOnly) - 1];
                 }
                 header("Content-Type: application/forcedownload");
                 header("Content-Disposition: attachment; filename=" . $fileNameOnly);
                 header("Content-Description: File Transfert");
                 header("Content-Transfer-Encoding: binary");
                 header("Pragma: no-cache");
                 header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
                 header("Expires: 0");
                 header("Content-Length: " . filesize($fileName));
                 readfile($fileName);
                 flush();
             }
             break;
         case COPIX_AR_BINARY:
             $fileName = $toProcess->data;
             //echo $fileName;
             if (is_readable($fileName) && is_file($fileName)) {
                 header("Content-Type: " . $toProcess->more);
                 header("Content-Length: " . filesize($fileName));
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:phpannu-svn,代码行数:101,代码来源:CopixCoordination.class.php


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