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


PHP getTemplatePath函数代码示例

本文整理汇总了PHP中getTemplatePath函数的典型用法代码示例。如果您正苦于以下问题:PHP getTemplatePath函数的具体用法?PHP getTemplatePath怎么用?PHP getTemplatePath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: display

function display($template, $data = array())
{
    //Собираем общий путь для дальнейшего использования.
    //Когда один и тот же код используется более одного раза - стоит вынести его в функцию/переменную
    $fullPath = getTemplatePath($template);
    //Если файл не существует, ничего не отображаем, с включеным дебагом выводит сообщение об этом
    if (!file_exists($fullPath)) {
        debug("Can't find template name " . $fullPath);
        return;
    }
    //Создает переменный с массива, документация http://php.net/manual/ru/function.extract.php
    extract($data);
    //Начинаем буфер, не обязательно, но может пригодится если мы захотим обработать получившийся шаблон
    ob_start();
    //Подключаем хедер
    include getTemplatePath("include/header");
    //Подключаем контроллер(модуль)
    include $fullPath;
    //Подключаем футер
    include getTemplatePath("include/footer");
    //Забираем в переменную весь буфер вывода и очищаем его
    $page = ob_get_clean();
    //Выводим клиенту наш буфер и завершаем работу скрипта
    exit($page);
}
开发者ID:ddeadlink,项目名称:pet_project,代码行数:25,代码来源:func.php

示例2: actionLocal

 function actionLocal($surveyid, $token, $langcode = '')
 {
     Yii::app()->loadHelper('database');
     Yii::app()->loadHelper('sanitize');
     $sLanguageCode = $langcode;
     $iSurveyID = $surveyid;
     $sToken = $token;
     $sToken = sanitize_token($sToken);
     if (!$iSurveyID) {
         $this->redirect($this->getController()->createUrl('/'));
     }
     $iSurveyID = (int) $iSurveyID;
     //Check that there is a SID
     // Get passed language from form, so that we dont loose this!
     if (!isset($sLanguageCode) || $sLanguageCode == "" || !$sLanguageCode) {
         $baselang = Survey::model()->findByPk($iSurveyID)->language;
         Yii::import('application.libraries.Limesurvey_lang', true);
         $clang = new Limesurvey_lang($baselang);
     } else {
         $sLanguageCode = sanitize_languagecode($sLanguageCode);
         Yii::import('application.libraries.Limesurvey_lang', true);
         $clang = new Limesurvey_lang($sLanguageCode);
         $baselang = $sLanguageCode;
     }
     Yii::app()->lang = $clang;
     $thissurvey = getSurveyInfo($iSurveyID, $baselang);
     if ($thissurvey == false || Yii::app()->db->schema->getTable("{{tokens_{$iSurveyID}}}") == null) {
         $html = $clang->gT('This survey does not seem to exist.');
     } else {
         $row = Tokens_dynamic::getEmailStatus($iSurveyID, $sToken);
         if ($row == false) {
             $html = $clang->gT('You are not a participant in this survey.');
         } else {
             $usresult = $row['emailstatus'];
             if ($usresult == 'OptOut') {
                 $usresult = Tokens_dynamic::updateEmailStatus($iSurveyID, $sToken, 'OK');
                 $html = $clang->gT('You have been successfully added back to this survey.');
             } else {
                 if ($usresult == 'OK') {
                     $html = $clang->gT('You are already a part of this survey.');
                 } else {
                     $html = $clang->gT('You have been already removed from this survey.');
                 }
             }
         }
     }
     //PRINT COMPLETED PAGE
     if (!$thissurvey['templatedir']) {
         $thistpl = getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
     } else {
         $thistpl = getTemplatePath($thissurvey['templatedir']);
     }
     $this->_renderHtml($html, $thistpl, $clang);
 }
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:54,代码来源:OptinController.php

示例3: actiontokens

 function actiontokens($surveyid, $token, $langcode = '')
 {
     Yii::app()->loadHelper('database');
     Yii::app()->loadHelper('sanitize');
     $sLanguageCode = $langcode;
     $iSurveyID = $surveyid;
     $sToken = $token;
     $sToken = sanitize_token($sToken);
     if (!$iSurveyID) {
         $this->redirect(array('/'));
     }
     $iSurveyID = (int) $iSurveyID;
     //Check that there is a SID
     // Get passed language from form, so that we dont loose this!
     if (!isset($sLanguageCode) || $sLanguageCode == "" || !$sLanguageCode) {
         $sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
         Yii::import('application.libraries.Limesurvey_lang', true);
         $clang = new Limesurvey_lang($sBaseLanguage);
     } else {
         $sLanguageCode = sanitize_languagecode($sLanguageCode);
         Yii::import('application.libraries.Limesurvey_lang', true);
         $clang = new Limesurvey_lang($sLanguageCode);
         $sBaseLanguage = $sLanguageCode;
     }
     Yii::app()->lang = $clang;
     $aSurveyInfo = getSurveyInfo($iSurveyID, $sBaseLanguage);
     if ($aSurveyInfo == false || !tableExists("{{tokens_{$iSurveyID}}}")) {
         $sMessage = $clang->gT('This survey does not seem to exist.');
     } else {
         $oToken = Token::model($iSurveyID)->findByAttributes(array('token' => $token));
         if (!isset($oToken)) {
             $sMessage = $clang->gT('You are not a participant in this survey.');
         } else {
             if ($oToken->emailstatus == 'OptOut') {
                 $oToken->emailstatus = 'OK';
                 $oToken->save();
                 $sMessage = $clang->gT('You have been successfully added back to this survey.');
             } elseif ($oToken->emailstatus == 'OK') {
                 $sMessage = $clang->gT('You are already a part of this survey.');
             } else {
                 $sMessage = $clang->gT('You have been already removed from this survey.');
             }
         }
     }
     //PRINT COMPLETED PAGE
     if (!$aSurveyInfo['templatedir']) {
         $sTemplate = getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
     } else {
         $sTemplate = getTemplatePath($aSurveyInfo['templatedir']);
     }
     $this->_renderHtml($sMessage, $sTemplate, $clang, $aSurveyInfo);
 }
开发者ID:josetorerobueno,项目名称:test_repo,代码行数:52,代码来源:OptinController.php

示例4: getTemplateSize

function getTemplateSize($type, $width, $height, $type)
{
    global $nativeTeamplateConfig;
    echo $type . ' ' . $width . ' ' . $height . '<br>';
    $teamplateNum = getTemplatePath($type, $width, $height);
    //echo $teamplateNum.' |';
    $size = array('w' => '0', 'h' => '0');
    $config = $nativeTeamplateConfig[$teamplateNum];
    $size['w'] = getWidth($width, $config['minWidth'], $config['padding'], $height, $type);
    //var_dump($config);
    $size['h'] = $height + $config['addHeight'];
    //var_dump($size);
    return $size;
}
开发者ID:yaodayizi,项目名称:test3,代码行数:14,代码来源:create.php

示例5: actiontokens

 function actiontokens($surveyid, $token, $langcode = '')
 {
     Yii::app()->loadHelper('database');
     Yii::app()->loadHelper('sanitize');
     $sLanguageCode = $langcode;
     $iSurveyID = $surveyid;
     $sToken = $token;
     $sToken = sanitize_token($sToken);
     if (!$iSurveyID) {
         $this->redirect(array('/'));
     }
     $iSurveyID = (int) $iSurveyID;
     //Check that there is a SID
     // Get passed language from form, so that we dont loose this!
     if (!isset($sLanguageCode) || $sLanguageCode == "" || !$sLanguageCode) {
         $sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
     } else {
         $sBaseLanguage = sanitize_languagecode($sLanguageCode);
     }
     Yii::app()->setLanguage($sBaseLanguage);
     $aSurveyInfo = getSurveyInfo($iSurveyID, $sBaseLanguage);
     if ($aSurveyInfo == false || !tableExists("{{tokens_{$iSurveyID}}}")) {
         throw new CHttpException(404, "This survey does not seem to exist. It may have been deleted or the link you were given is outdated or incorrect.");
     } else {
         LimeExpressionManager::singleton()->loadTokenInformation($iSurveyID, $token, false);
         $oToken = Token::model($iSurveyID)->findByAttributes(array('token' => $token));
         if (!isset($oToken)) {
             $sMessage = gT('You are not a participant in this survey.');
         } else {
             if ($oToken->emailstatus == 'OptOut') {
                 $oToken->emailstatus = 'OK';
                 $oToken->save();
                 $sMessage = gT('You have been successfully added back to this survey.');
             } elseif ($oToken->emailstatus == 'OK') {
                 $sMessage = gT('You are already a part of this survey.');
             } else {
                 $sMessage = gT('You have been already removed from this survey.');
             }
         }
     }
     //PRINT COMPLETED PAGE
     if (!$aSurveyInfo['templatedir']) {
         $sTemplate = getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
     } else {
         $sTemplate = getTemplatePath($aSurveyInfo['templatedir']);
     }
     $this->_renderHtml($sMessage, $sTemplate, $aSurveyInfo);
 }
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:48,代码来源:OptinController.php

示例6: templatereplace

/**
* This function replaces keywords in a text and is mainly intended for templates
* If you use this functions put your replacement strings into the $replacements variable
* instead of using global variables
* NOTE - Don't do any embedded replacements in this function.  Create the array of replacement values and
* they will be done in batch at the end
*
* @param mixed $line Text to search in
* @param mixed $replacements Array of replacements:  Array( <stringtosearch>=><stringtoreplacewith>
* @param boolean $anonymized Determines if token data is being used or just replaced with blanks
* @param questionNum - needed to support dynamic JavaScript-based tailoring within questions
* @param bStaticReplacement - Default off, forces non-dynamic replacements without <SPAN> tags (e.g. for the Completed page)
* @return string  Text with replaced strings
*/
function templatereplace($line, $replacements = array(), &$redata = array(), $debugSrc = 'Unspecified', $anonymized = false, $questionNum = NULL, $registerdata = array(), $bStaticReplacement = false, $oTemplate = '')
{
    /*
    global $clienttoken,$token,$sitename,$move,$showxquestions,$showqnumcode,$questioncode;
    global $s_lang,$errormsg,$saved_id, $languagechanger,$captchapath,$loadname;
    */
    /*
    $allowedvars = array('surveylist', 'sitename', 'clienttoken', 'rooturl', 'thissurvey', 'imageurl', 'defaulttemplate',
    'percentcomplete', 'move', 'groupname', 'groupdescription', 'question', 'showxquestions',
    'showgroupinfo', 'showqnumcode', 'questioncode', 'answer', 'navigator', 'help', 'totalquestions',
    'surveyformat', 'completed', 'notanswered', 'privacy', 'surveyid', 'publicurl',
    'templatedir', 'token', 'assessments', 's_lang', 'errormsg', 'saved_id', 'usertemplaterootdir',
    'languagechanger', 'printoutput', 'captchapath', 'loadname');
    */
    $allowedvars = array('assessments', 'captchapath', 'clienttoken', 'completed', 'errormsg', 'groupdescription', 'groupname', 'imageurl', 'languagechanger', 'loadname', 'move', 'navigator', 'moveprevbutton', 'movenextbutton', 'percentcomplete', 'privacy', 's_lang', 'saved_id', 'showgroupinfo', 'showqnumcode', 'showxquestions', 'sitename', 'sitelogo', 'surveylist', 'templatedir', 'thissurvey', 'token', 'totalBoilerplatequestions', 'totalquestions', 'questionindex', 'questionindexmenu');
    $varsPassed = array();
    foreach ($allowedvars as $var) {
        if (isset($redata[$var])) {
            ${$var} = $redata[$var];
            $varsPassed[] = $var;
        }
    }
    //    if (count($varsPassed) > 0) {
    //        log_message('debug', 'templatereplace() called from ' . $debugSrc . ' contains: ' . implode(', ', $varsPassed));
    //    }
    //    if (isset($redata['question'])) {
    //        LimeExpressionManager::ShowStackTrace('has QID and/or SGA',$allowedvars);
    //    }
    //    extract($redata);   // creates variables for each of the keys in the array
    // Local over-rides in case not set above
    if (!isset($showgroupinfo)) {
        $showgroupinfo = Yii::app()->getConfig('showgroupinfo');
    }
    if (!isset($showqnumcode)) {
        $showqnumcode = Yii::app()->getConfig('showqnumcode');
    }
    $_surveyid = Yii::app()->getConfig('surveyID');
    if (!isset($showxquestions)) {
        $showxquestions = Yii::app()->getConfig('showxquestions');
    }
    if (!isset($s_lang)) {
        $s_lang = isset(Yii::app()->session['survey_' . $_surveyid]['s_lang']) ? Yii::app()->session['survey_' . $_surveyid]['s_lang'] : 'en';
    }
    if ($_surveyid && !isset($thissurvey)) {
        $thissurvey = getSurveyInfo($_surveyid, $s_lang);
    }
    if (!isset($captchapath)) {
        $captchapath = '';
    }
    if (!isset($sitename)) {
        $sitename = Yii::app()->getConfig('sitename');
    }
    if (!isset($saved_id) && isset(Yii::app()->session['survey_' . $_surveyid]['srid'])) {
        $saved_id = Yii::app()->session['survey_' . $_surveyid]['srid'];
    }
    Yii::app()->loadHelper('surveytranslator');
    if (isset($thissurvey['sid'])) {
        $surveyid = $thissurvey['sid'];
    }
    // lets sanitize the survey template
    if (isset($thissurvey['templatedir'])) {
        $templatename = $thissurvey['templatedir'];
    } else {
        $templatename = Yii::app()->getConfig('defaulttemplate');
    }
    if (!isset($templatedir)) {
        $templatedir = getTemplatePath($templatename);
    }
    if (!isset($templateurl)) {
        $templateurl = getTemplateURL($templatename) . "/";
    }
    if (!$anonymized && isset($thissurvey['anonymized'])) {
        $anonymized = $thissurvey['anonymized'] == "Y";
    }
    // TEMPLATECSS
    $_templatecss = "";
    $_templatejs = "";
    /**
     * Template css/js files from the template config files are loaded.
     * It use the asset manager (so user never need to empty the cache, even if template is updated)
     * If debug mode is on, no asset manager is used.
     *
     * oTemplate is defined in controller/survey/index
     *
     * If templatereplace is called from the template editor, a $oTemplate is provided.
     */
//.........这里部分代码省略.........
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:101,代码来源:replacements_helper.php

示例7: actionView

 /**
  * printanswers::view()
  * View answers at the end of a survey in one place. To export as pdf, set 'usepdfexport' = 1 in lsconfig.php and $printableexport='pdf'.
  * @param mixed $surveyid
  * @param bool $printableexport
  * @return
  */
 function actionView($surveyid, $printableexport = FALSE)
 {
     Yii::app()->loadHelper("frontend");
     Yii::import('application.libraries.admin.pdf');
     $iSurveyID = (int) $surveyid;
     $sExportType = $printableexport;
     Yii::app()->loadHelper('database');
     if (isset($_SESSION['survey_' . $iSurveyID]['sid'])) {
         $iSurveyID = $_SESSION['survey_' . $iSurveyID]['sid'];
     } else {
         //die('Invalid survey/session');
     }
     // Get the survey inforamtion
     // Set the language for dispay
     if (isset($_SESSION['survey_' . $iSurveyID]['s_lang'])) {
         $sLanguage = $_SESSION['survey_' . $iSurveyID]['s_lang'];
     } elseif (Survey::model()->findByPk($iSurveyID)) {
         $sLanguage = Survey::model()->findByPk($iSurveyID)->language;
     } else {
         $iSurveyID = 0;
         $sLanguage = Yii::app()->getConfig("defaultlang");
     }
     $clang = SetSurveyLanguage($iSurveyID, $sLanguage);
     $aSurveyInfo = getSurveyInfo($iSurveyID, $sLanguage);
     //SET THE TEMPLATE DIRECTORY
     if (!isset($aSurveyInfo['templatedir']) || !$aSurveyInfo['templatedir']) {
         $aSurveyInfo['templatedir'] = Yii::app()->getConfig('defaulttemplate');
     }
     $sTemplate = validateTemplateDir($aSurveyInfo['templatedir']);
     //Survey is not finished or don't exist
     if (!isset($_SESSION['survey_' . $iSurveyID]['finished']) || !isset($_SESSION['survey_' . $iSurveyID]['srid'])) {
         sendCacheHeaders();
         doHeader();
         echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/startpage.pstpl'), array());
         echo "<center><br />\n" . "\t<font color='RED'><strong>" . $clang->gT("Error") . "</strong></font><br />\n" . "\t" . $clang->gT("We are sorry but your session has expired.") . "<br />" . $clang->gT("Either you have been inactive for too long, you have cookies disabled for your browser, or there were problems with your connection.") . "<br />\n" . "\t" . sprintf($clang->gT("Please contact %s ( %s ) for further assistance."), Yii::app()->getConfig("siteadminname"), Yii::app()->getConfig("siteadminemail")) . "\n" . "</center><br />\n";
         echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/endpage.pstpl'), array());
         doFooter();
         exit;
     }
     //Fin session time out
     $sSRID = $_SESSION['survey_' . $iSurveyID]['srid'];
     //I want to see the answers with this id
     //Ensure script is not run directly, avoid path disclosure
     //if (!isset($rootdir) || isset($_REQUEST['$rootdir'])) {die( "browse - Cannot run this script directly");}
     if ($aSurveyInfo['printanswers'] == 'N') {
         die;
         //Die quietly if print answers is not permitted
     }
     //CHECK IF SURVEY IS ACTIVATED AND EXISTS
     $sSurveyName = $aSurveyInfo['surveyls_title'];
     $sAnonymized = $aSurveyInfo['anonymized'];
     //OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.
     //SHOW HEADER
     $sOutput = CHtml::form(array("printanswers/view/surveyid/{$iSurveyID}/printableexport/pdf"), 'post') . "<center><input type='submit' value='" . $clang->gT("PDF export") . "'id=\"exportbutton\"/><input type='hidden' name='printableexport' /></center></form>";
     if ($sExportType == 'pdf') {
         //require (Yii::app()->getConfig('rootdir').'/application/config/tcpdf.php');
         Yii::import('application.libraries.admin.pdf', true);
         Yii::import('application.helpers.pdfHelper');
         $aPdfLanguageSettings = pdfHelper::getPdfLanguageSettings($clang->langcode);
         $oPDF = new pdf();
         $oPDF->SetTitle($clang->gT("Survey name (ID)", 'unescaped') . ": {$sSurveyName} ({$iSurveyID})");
         $oPDF->SetSubject($sSurveyName);
         $oPDF->SetDisplayMode('fullpage', 'two');
         $oPDF->setLanguageArray($aPdfLanguageSettings['lg']);
         $oPDF->setHeaderFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_MAIN));
         $oPDF->setFooterFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_DATA));
         $oPDF->SetFont($aPdfLanguageSettings['pdffont'], '', $aPdfLanguageSettings['pdffontsize']);
         $oPDF->AddPage();
         $oPDF->titleintopdf($clang->gT("Survey name (ID)", 'unescaped') . ": {$sSurveyName} ({$iSurveyID})");
     }
     $sOutput .= "\t<div class='printouttitle'><strong>" . $clang->gT("Survey name (ID):") . "</strong> {$sSurveyName} ({$iSurveyID})</div><p>&nbsp;\n";
     LimeExpressionManager::StartProcessingPage(true);
     // means that all variables are on the same page
     // Since all data are loaded, and don't need JavaScript, pretend all from Group 1
     LimeExpressionManager::StartProcessingGroup(1, $aSurveyInfo['anonymized'] != "N", $iSurveyID);
     $printanswershonorsconditions = Yii::app()->getConfig('printanswershonorsconditions');
     $aFullResponseTable = getFullResponseTable($iSurveyID, $sSRID, $sLanguage, $printanswershonorsconditions);
     //Get the fieldmap @TODO: do we need to filter out some fields?
     if ($aSurveyInfo['datestamp'] != "Y" || $sAnonymized == 'Y') {
         unset($aFullResponseTable['submitdate']);
     } else {
         unset($aFullResponseTable['id']);
     }
     unset($aFullResponseTable['token']);
     unset($aFullResponseTable['lastpage']);
     unset($aFullResponseTable['startlanguage']);
     unset($aFullResponseTable['datestamp']);
     unset($aFullResponseTable['startdate']);
     $sOutput .= "<table class='printouttable' >\n";
     foreach ($aFullResponseTable as $sFieldname => $fname) {
         if (substr($sFieldname, 0, 4) == 'gid_') {
             $sOutput .= "\t<tr class='printanswersgroup'><td colspan='2'>{$fname[0]}</td></tr>\n";
         } elseif (substr($sFieldname, 0, 4) == 'qid_') {
//.........这里部分代码省略.........
开发者ID:josetorerobueno,项目名称:test_repo,代码行数:101,代码来源:PrintanswersController.php

示例8: XMLImportSurvey

/**
* This function imports a LimeSurvey .lss survey XML file
*
* @param mixed $sFullFilePath  The full filepath of the uploaded file
*/
function XMLImportSurvey($sFullFilePath, $sXMLdata = NULL, $sNewSurveyName = NULL, $iDesiredSurveyId = NULL, $bTranslateInsertansTags = true, $bConvertInvalidQuestionCodes = true)
{
    Yii::app()->loadHelper('database');
    $clang = Yii::app()->lang;
    $aGIDReplacements = array();
    if ($sXMLdata == NULL) {
        $sXMLdata = file_get_contents($sFullFilePath);
    }
    $xml = @simplexml_load_string($sXMLdata, 'SimpleXMLElement', LIBXML_NONET);
    if (!$xml || $xml->LimeSurveyDocType != 'Survey') {
        $results['error'] = $clang->gT("This is not a valid LimeSurvey survey structure XML file.");
        return $results;
    }
    $pre_personal_characteristics = "";
    $question_groups['R'] = array();
    $question_groups['I'] = array();
    $question_groups['O'] = array();
    $iDBVersion = (int) $xml->DBVersion;
    $aQIDReplacements = array();
    $aQuestionCodeReplacements = array();
    $aQuotaReplacements = array();
    $results['defaultvalues'] = 0;
    $results['answers'] = 0;
    $results['surveys'] = 0;
    $results['questions'] = 0;
    $results['subquestions'] = 0;
    $results['question_attributes'] = 0;
    $results['groups'] = 0;
    $results['assessments'] = 0;
    $results['quota'] = 0;
    $results['quotals'] = 0;
    $results['quotamembers'] = 0;
    $results['survey_url_parameters'] = 0;
    $results['importwarnings'] = array();
    $aLanguagesSupported = array();
    foreach ($xml->languages->language as $language) {
        $aLanguagesSupported[] = (string) $language;
    }
    $results['languages'] = count($aLanguagesSupported);
    // Import surveys table ====================================================
    foreach ($xml->surveys->rows->row as $row) {
        $insertdata = array();
        foreach ($row as $key => $value) {
            $insertdata[(string) $key] = (string) $value;
        }
        $iOldSID = $results['oldsid'] = $insertdata['sid'];
        if ($iDesiredSurveyId != NULL) {
            $insertdata['wishSID'] = GetNewSurveyID($iDesiredSurveyId);
        } else {
            $insertdata['wishSID'] = $iOldSID;
        }
        if ($iDBVersion < 145) {
            if (isset($insertdata['private'])) {
                $insertdata['anonymized'] = $insertdata['private'];
            }
            unset($insertdata['private']);
            unset($insertdata['notification']);
        }
        //Make sure it is not set active
        $insertdata['active'] = 'N';
        //Set current user to be the owner
        $insertdata['owner_id'] = Yii::app()->session['loginID'];
        if (isset($insertdata['bouncetime']) && $insertdata['bouncetime'] == '') {
            $insertdata['bouncetime'] = NULL;
        }
        if (isset($insertdata['showXquestions'])) {
            $insertdata['showxquestions'] = $insertdata['showXquestions'];
            unset($insertdata['showXquestions']);
        }
        // Special code to set javascript in
        Yii::app()->loadHelper('admin/template');
        $newname = "watson_" . time();
        $newdirname = Yii::app()->getConfig('usertemplaterootdir') . "/" . $newname;
        $copydirname = getTemplatePath("watson_personal_constructs_copy_me");
        $oFileHelper = new CFileHelper();
        $mkdirresult = mkdir_p($newdirname);
        if ($mkdirresult == 1) {
            $oFileHelper->copyDirectory($copydirname, $newdirname);
            $templatename = $newname;
            //$this->index("startpage.pstpl", "welcome", $templatename);
        } elseif ($mkdirresult == 2) {
            $results['Error'] = sprintf($clang->gT("Directory with the name `%s` already exists - choose another name", "js"), $newname);
        } else {
            $results['Error'] = sprintf($clang->gT("Unable to create directory `%s`.", "js"), $newname) . " " . $clang->gT("Please check the directory permissions.", "js");
        }
        $insertdata['template'] = $newname;
        // End special copy code (taken from templates.php templatecopy() method
        if (isset($insertdata['googleAnalyticsStyle'])) {
            $insertdata['googleanalyticsstyle'] = $insertdata['googleAnalyticsStyle'];
            unset($insertdata['googleAnalyticsStyle']);
        }
        if (isset($insertdata['googleAnalyticsAPIKey'])) {
            $insertdata['googleanalyticsapikey'] = $insertdata['googleAnalyticsAPIKey'];
            unset($insertdata['googleAnalyticsAPIKey']);
        }
//.........这里部分代码省略.........
开发者ID:rouben,项目名称:LimeSurvey,代码行数:101,代码来源:import_helper.php

示例9: _LANG

        $msgstr = $_SLANG['printmsg.nofun.member'];
        $msglink = $msglink2;
        break;
    case "funshop_off":
        $msgstr = $_SLANG['printmsg.nofun.order'];
        $msglink = $msglink2;
        break;
    case "public_active_err":
        $msgstr = $_SLANG['printmsg.activelink.outdate'];
        $msglink = "<a href='public.php?action=getactive'><u>{$_SLANG['printmsg.sendactive']}</u> <img src=\"images/ico_msgp1.gif\" border=\"0\" align=\"absmiddle\" alt=\"\" /></a>";
        break;
    case "public_active_succeed":
        $msgstr = $_SLANG['printmsg.active.succeed'];
        $msglink = "<a href='login.php'><u>{$_SLANG['printmsg.login.now']}</u> <img src=\"images/ico_go.gif\" border=\"0\" align=\"absmiddle\" alt=\"\" /></a>";
        break;
    case "public_resetpass_err":
        $msgstr = $_SLANG['printmsg.reset.outdate'];
        $msglink = "<a href='public.php?action=forgetpass'><u>{$_SLANG['printmsg.reset.send']}</u> <img src=\"images/ico_msgp1.gif\" border=\"0\" align=\"absmiddle\" alt=\"\" /></a>";
        break;
    case "public_resetpass_succeed":
        global $newpass;
        $msgstr = _LANG($_SLANG['printmsg.reset.succeed'], array("<span class='msg_newpass'>{$newpass}</span>"));
        $msglink = "<a href='login.php'><u>{$_SLANG['printmsg.login.now']}</u> <img src=\"images/ico_go.gif\" border=\"0\" align=\"absmiddle\" alt=\"\" /></a>";
        break;
}
if ($msgstr == "") {
    $msgstr = $msg_code;
}
require_once 'header.php';
require_once getTemplatePath('printmsg.htm');
footer();
开发者ID:rust1989,项目名称:edit,代码行数:31,代码来源:printmsg.php

示例10: getDateStr

    $id = $row['id'];
    $db->row_query("update {$db->pre}products set hits=hits+1 where id={$id}");
    $row['posttime'] = getDateStr($row['posttime'], 0, 0);
    $row['name'] = htmlFilter($row['name']);
    $row['serialnum'] = htmlFilter($row['serialnum']);
    $row['price1'] = number_format($row['price1'], 2);
    $row['content'] = $parsefile->parse($row['content']);
    $row['smallimages'] = '';
    $pics = $webcore->getPics($row['picids'], $row['picpaths'], -1, true, true);
    foreach ($pics as $pic) {
        $row['smallimages'] .= intval($pic['picid']) > 0 ? "<li id=\"liimg_{$pic['picpath']}\"><img src=\"{$pic['picpath']}\" /></li>" : "";
    }
    $row['picpath'] = $pics[0]['picpath'];
    unset($pics);
}
empty($row) && $webcore->checkViewLang('product', $id);
$cid = $row['cid'];
$procate = $cache_procates[$cid];
$_SYS['positionchannel'] = " » <a href=" . $webcore->genUrl("productlist.php?cid={$procate['id']}") . ">{$procate['title']}</a>";
$headtitle = empty($row['seotitle']) ? strip_tags($row['name']) : strip_tags(str_replace(array("\r", "\n"), array('', ''), $row['seotitle']));
$headtitle .= " - {$procate['title']}";
$headkeywords = empty($row['metakeywords']) ? $headtitle : strip_tags(str_replace(array("\r", "\n"), array('', ''), $row['metakeywords']));
$headdesc = empty($row['metadesc']) ? $headtitle : strip_tags(str_replace(array("\r", "\n"), array('', ''), $row['metadesc']));
if (intval($procate['pid']) > 0) {
    $tmpcate = $cache_procates[$procate['pid']];
    $headtitle .= " - " . strip_tags($tmpcate['title']);
    $_SYS['positionchannel'] = " » <a href=" . $webcore->genUrl("productlist.php?cid={$tmpcate['id']}") . ">{$tmpcate['title']}</a>" . $_SYS['positionchannel'];
}
require_once './header.php';
require_once getTemplatePath('product.htm');
footer();
开发者ID:rust1989,项目名称:edit,代码行数:31,代码来源:product.php

示例11: checkCompletedQuota

/**
* checkCompletedQuota() returns matched quotas information for the current response
* @param integer $surveyid - Survey identification number
* @param bool $return - set to true to return information, false do the quota
* @return array - nested array, Quotas->Members->Fields, includes quota information matched in session.
*/
function checkCompletedQuota($surveyid, $return = false)
{
    if (!isset($_SESSION['survey_' . $surveyid]['srid'])) {
        return;
    }
    static $aMatchedQuotas;
    // EM call 2 times quotas with 3 lines of php code, then use static.
    if (!$aMatchedQuotas) {
        $aMatchedQuotas = array();
        $quota_info = $aQuotasInfo = getQuotaInformation($surveyid, $_SESSION['survey_' . $surveyid]['s_lang']);
        // $aQuotasInfo have an 'active' key, we don't use it ?
        if (!$aQuotasInfo || empty($aQuotasInfo)) {
            return $aMatchedQuotas;
        }
        // Test only completed quota, other is not needed
        $aQuotasCompleted = array();
        foreach ($aQuotasInfo as $aQuotaInfo) {
            $iCompleted = getQuotaCompletedCount($surveyid, $aQuotaInfo['id']);
            // Return a string
            if (ctype_digit($iCompleted) && (int) $iCompleted >= (int) $aQuotaInfo['qlimit']) {
                // This remove invalid quota and not completed
                $aQuotasCompleted[] = $aQuotaInfo;
            }
        }
        if (empty($aQuotasCompleted)) {
            return $aMatchedQuotas;
        }
        // OK, we have some quota, then find if this $_SESSION have some set
        $aPostedFields = explode("|", Yii::app()->request->getPost('fieldnames', ''));
        // Needed for quota allowing update
        foreach ($aQuotasCompleted as $aQuotaCompleted) {
            $iMatchedAnswers = 0;
            $bPostedField = false;
            // Array of field with quota array value
            $aQuotaFields = array();
            // Array of fieldnames with relevance value : EM fill $_SESSION with default value even is unrelevant (em_manager_helper line 6548)
            $aQuotaRelevantFieldnames = array();
            foreach ($aQuotaCompleted['members'] as $aQuotaMember) {
                $aQuotaFields[$aQuotaMember['fieldname']][] = $aQuotaMember['value'];
                $aQuotaRelevantFieldnames[$aQuotaMember['fieldname']] = isset($_SESSION['survey_' . $surveyid]['relevanceStatus'][$aQuotaMember['qid']]) && $_SESSION['survey_' . $surveyid]['relevanceStatus'][$aQuotaMember['qid']];
            }
            // For each field : test if actual responses is in quota (and is relevant)
            foreach ($aQuotaFields as $sFieldName => $aValues) {
                $bInQuota = isset($_SESSION['survey_' . $surveyid][$sFieldName]) && in_array($_SESSION['survey_' . $surveyid][$sFieldName], $aValues);
                if ($bInQuota && $aQuotaRelevantFieldnames[$sFieldName]) {
                    $iMatchedAnswers++;
                }
                if (in_array($sFieldName, $aPostedFields)) {
                    $bPostedField = true;
                }
            }
            if ($iMatchedAnswers == count($aQuotaFields)) {
                switch ($aQuotaCompleted['action']) {
                    case '1':
                    default:
                        $aMatchedQuotas[] = $aQuotaCompleted;
                        break;
                    case '2':
                        if ($bPostedField) {
                            // Action 2 allow to correct last answers, then need to be posted
                            $aMatchedQuotas[] = $aQuotaCompleted;
                        }
                        break;
                }
            }
        }
    }
    if ($return) {
        return $aMatchedQuotas;
    }
    if (empty($aMatchedQuotas)) {
        return;
    }
    // Now we have all the information we need about the quotas and their status.
    // We need to construct the page and do all needed action
    $aSurveyInfo = getSurveyInfo($surveyid, $_SESSION['survey_' . $surveyid]['s_lang']);
    $sTemplatePath = getTemplatePath($aSurveyInfo['templatedir']);
    $sClientToken = isset($_SESSION['survey_' . $surveyid]['token']) ? $_SESSION['survey_' . $surveyid]['token'] : "";
    // {TOKEN} is take by $redata ...
    // $redata for templatereplace
    $aDataReplacement = array('thissurvey' => $aSurveyInfo, 'clienttoken' => $sClientToken, 'token' => $sClientToken);
    // We take only the first matched quota, no need for each
    $aMatchedQuota = $aMatchedQuotas[0];
    // If a token is used then mark the token as completed, do it before event : this allow plugin to update token information
    $event = new PluginEvent('afterSurveyQuota');
    $event->set('surveyId', $surveyid);
    $event->set('responseId', $_SESSION['survey_' . $surveyid]['srid']);
    // We allways have a responseId
    $event->set('aMatchedQuotas', $aMatchedQuotas);
    // Give all the matched quota : the first is the active
    App()->getPluginManager()->dispatchEvent($event);
    $blocks = array();
    foreach ($event->getAllContent() as $blockData) {
        /* @var $blockData PluginEventContent */
//.........这里部分代码省略.........
开发者ID:elcharlygraf,项目名称:Encuesta-YiiFramework,代码行数:101,代码来源:frontend_helper.php

示例12: intval

        $secmenu .= "<li class='big'><a href=\"" . $webcore->genNavLink($tmpchannel) . "\">{$tmpchannel['title']}</a></li>";
    }
} else {
    $par_channel = $channel;
}
$msgkey = $_GET['msgkey'];
$curPage = intval($_GET["page"]);
$condition = "langid={$_SYS['langid']} and state=1";
$condition .= empty($msgkey) ? "" : " and (name like '%{$msgkey}%' or title like '%{$msgkey}%' or remark like '%{$msgkey}%' or reply like '%{$msgkey}%')";
$orderstr = "id desc";
$pagerlink = $webcore->genUrl("msg.php?page={page}" . (empty($msgkey) ? "" : "&msgkey={$msgkey}"));
$pager = new Pager();
$pager->init(intval($cache_settings['perpagemsg']), $curPage, $pagerlink);
$msgs = $pager->queryRows($db, "msgs", $condition, "*", $orderstr);
$index = 0;
foreach ($msgs as $key => $msg) {
    $msg['mod'] = ++$index % 2;
    $msg['name'] = htmlFilter($msg['name']);
    $msg['email'] = htmlFilter($msg['email']);
    $msg['contact1'] = htmlFilter($msg['contact1']);
    $msg['title'] = htmlFilter($msg['title']);
    $msg['remark'] = nl2br(htmlFilter($msg['remark']));
    $msg['posttime'] = getDateStr($msg['posttime']);
    $msg['replytime'] = getDateStr($msg['replytime']);
    $msgs[$key] = $msg;
}
$_SYS['positionchannel'] = " » <a href=" . $webcore->genUrl("msg.php") . ">{$channel['title']}</a>";
$msgkey = empty($msgkey) ? $_LANG['header.search'] : htmlFilter($msgkey);
require_once './header.php';
require_once getTemplatePath('msg.htm');
footer();
开发者ID:rust1989,项目名称:edit,代码行数:31,代码来源:msg.php

示例13: strFilter

if ($_GET['action'] == "checklogin") {
    $username = strFilter($_POST['membername']);
    $userpass = strFilter($_POST['memberpass']);
    $userpass = encrypt($username, $userpass);
    if (empty($username) || empty($userpass)) {
        printMsg('signup_required_1');
    }
    $row = $db->row_select_one("members", "membername='{$username}' and memberpass='{$userpass}'");
    if ($row == false) {
        printMsg('login_namepasserr');
    } else {
        $uobj['logintime'] = time();
        $db->row_update("members", $uobj, "id={$row['id']}");
        $t = -86400 * 365 * 2;
        wSESSION('memberid', $row['id']);
        wSESSION('groupid', $row['groupid']);
        wSESSION('membername', $row['membername'], $t);
        wSESSION('memberpass', $row['memberpass'], $t);
        setCookies("cartid", $row['id'], 3600 * 24 * 7);
        //session_destroy();
        setCookies('membername', $username, $t);
        setCookies('userpass', $userpass, $t);
        setCookies('expire', '', $t);
        wSESSION('memberauth', md5($row['membername'] . $row['memberpass'] . $cache_global['salt']), $t);
        printMsg('login_succeed');
    }
} else {
    require_once './header.php';
    require_once getTemplatePath('login.htm');
    footer();
}
开发者ID:rust1989,项目名称:edit,代码行数:31,代码来源:login.php

示例14: replaceContent

function replaceContent($content)
{
    # Load main.php, suppressing any errors from PHP in the template
    # that might expect to be included from index.php.
    ob_start();
    include getTemplatePath('main');
    $output = ob_get_contents();
    ob_end_clean();
    # Return with theme tags replaced
    return replaceThemeTags(preg_replace('#<!-- CONTENT START -->.*<!-- CONTENT END -->#s', $content, $output));
}
开发者ID:milan-hwj,项目名称:tempGit,代码行数:11,代码来源:init.php

示例15: gT

<script type='text/javascript'>
    var graphUrl="<?php 
echo Yii::app()->getController()->createUrl("admin/statistics/sa/graph");
?>
";
</script>
        <div id='statsContainer'>
            <div id='statsHeader'>
                <div class='statsSurveyTitle'><?php 
echo $thisSurveyTitle;
?>
</div>
                <div class='statsNumRecords'><?php 
echo gT("Total records in survey") . " : {$totalrecords}";
?>
</div>
            </div>
            <?php 
if (isset($statisticsoutput) && $statisticsoutput) {
    echo $statisticsoutput;
}
?>
<br />
        </div>
<?php 
echo templatereplace(file_get_contents(getTemplatePath($sTemplatePath) . "/endpage.pstpl"), array(), $redata);
?>

开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:27,代码来源:statistics_user_view.php


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