• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP flattenText函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createNewUser

 /**
  * Create a DB user
  *
  * @return unknown_type
  */
 public function createNewUser()
 {
     // Do nothing if the user to be added is not DB type
     if (flattenText(Yii::app()->request->getPost('user_type')) != 'DB') {
         return;
     }
     $oEvent = $this->getEvent();
     $new_user = flattenText(Yii::app()->request->getPost('new_user'), false, true);
     $new_email = flattenText(Yii::app()->request->getPost('new_email'), false, true);
     if (!validateEmailAddress($new_email)) {
         $oEvent->set('errorCode', self::ERROR_INVALID_EMAIL);
         $oEvent->set('errorMessageTitle', gT("Failed to add user"));
         $oEvent->set('errorMessageBody', gT("The email address is not valid."));
         return;
     }
     $new_full_name = flattenText(Yii::app()->request->getPost('new_full_name'), false, true);
     $new_pass = createPassword();
     $iNewUID = User::model()->insertUser($new_user, $new_pass, $new_full_name, Yii::app()->session['loginID'], $new_email);
     if (!$iNewUID) {
         $oEvent->set('errorCode', self::ERROR_ALREADY_EXISTING_USER);
         $oEvent->set('errorMessageTitle', '');
         $oEvent->set('errorMessageBody', gT("Failed to add user"));
         return;
     }
     Permission::model()->setGlobalPermission($iNewUID, 'auth_db');
     $oEvent->set('newUserID', $iNewUID);
     $oEvent->set('newPassword', $new_pass);
     $oEvent->set('newEmail', $new_email);
     $oEvent->set('newFullName', $new_full_name);
     $oEvent->set('errorCode', self::ERROR_NONE);
 }
开发者ID:BrunoChauvet,项目名称:LimeSurvey,代码行数:36,代码来源:Authdb.php


示例2: addmessage

 function addmessage()
 {
     $clang = Yii::app()->lang;
     //        if (!Permission::model()->hasGlobalPermission('Regions', 'create')) {
     //            Yii::app()->setFlashMessage($clang->gT("You do not have sufficient rights to access this page."), 'error');
     //            $this->getController()->redirect(array("admin/country/index"));
     //        }
     $email_to = (int) Yii::app()->request->getPost("email_to");
     $subject = flattenText(Yii::app()->request->getPost('subject'));
     $message = flattenText(Yii::app()->request->getPost('message'));
     $parent = flattenText(Yii::app()->request->getPost('parent'));
     $chat = flattenText(Yii::app()->request->getPost('chat'));
     $aData = array();
     $aViewUrls = array();
     if (empty($email_to)) {
         $aViewUrls['message'] = array('title' => $clang->gT("Failed to send message"), 'message' => $clang->gT("Message was not supplied or the Message is invalid."), 'class' => 'warningheader');
     } elseif (empty($subject)) {
         $aViewUrls['message'] = array('title' => $clang->gT("Failed to send message"), 'message' => $clang->gT("Subject was not supplied or the Subject is invalid."), 'class' => 'warningheader');
     } elseif (empty($message)) {
         $aViewUrls['message'] = array('title' => $clang->gT("Failed to send message"), 'message' => $clang->gT("Message was not supplied or the Message is invalid."), 'class' => 'warningheader');
     } else {
         $NewMessage = Supoort_center::model()->instAdminMessage($email_to, $subject, $message, $parent, $chat);
         if ($NewMessage) {
             Yii::app()->setFlashMessage($clang->gT("message send successfully"));
             $this->getController()->redirect(array("admin/message/index"));
         } else {
             $aViewUrls['mboxwithredirect'][] = $this->_messageBoxWithRedirect($clang->gT("Failed to send message"), $clang->gT("Error in sending message."), 'warningheader');
         }
     }
     $this->_renderWrappedTemplate('message', $aViewUrls, $aData);
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:31,代码来源:message.php


示例3: stripTagsFull

/**
* Strips html tags and replaces new lines
*
* @param $string
* @return $string
*/
function stripTagsFull($string)
{
    $string = html_entity_decode($string, ENT_QUOTES, "UTF-8");
    //combining these into one mb_ereg_replace call ought to speed things up
    $string = str_replace(array("\r\n", "\r", "\n", '-oth-'), '', $string);
    //The backslashes must be escaped twice, once for php, and again for the regexp
    $string = str_replace("'|\\\\'", "'", $string);
    return flattenText($string);
}
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:15,代码来源:export_helper.php


示例4: mod

 function mod()
 {
     $clang = Yii::app()->lang;
     if (!Permission::model()->hasGlobalPermission('panellist', 'update')) {
         Yii::app()->setFlashMessage($clang->gT("You do not have sufficient rights to access this page."), 'error');
         $this->getController()->redirect(array("admin/index"));
     }
     $clang = Yii::app()->lang;
     $action = isset($_POST['action']) ? $_POST['action'] : '';
     $aData = array();
     $aViewUrls = array();
     if (Permission::model()->hasGlobalPermission('', 'create')) {
         if ($action == "editcategory") {
             // Project details
             $category_id = (int) Yii::app()->request->getPost("category_id");
             $category_title = flattenText($_POST['category_title'], false, true, 'UTF-8', true);
             $sort_order = flattenText($_POST['sort_order'], false, true, 'UTF-8', true);
             $IsActive = flattenText(Yii::app()->request->getPost("IsActive"));
             $is_Active = 0;
             if ($IsActive) {
                 $is_Active = 1;
             }
             if ($category_title == '') {
                 $aViewUrls['message'] = array('title' => $clang->gT("Failed to add Category"), 'message' => $clang->gT("Category Name is invalid."), 'class' => 'warningheader');
             } else {
                 $oUser = category::model()->findByPk($category_id);
                 $oUser->title = $category_title;
                 $oUser->sorder = $sort_order;
                 $oUser->IsActive = $is_Active;
                 $oUser->modified_date = Date('y-m-d h:i:s');
                 $NewCategory = $oUser->save();
                 if ($NewCategory) {
                     Yii::app()->setFlashMessage($clang->gT("Profile Category Updated successfully"));
                     $this->getController()->redirect(array("admin/profilecategory/index"));
                 }
             }
         } else {
             if (isset($_POST['category_id'])) {
                 $aData['row'] = 0;
                 $aData['usr_arr'] = array();
                 // Project detail
                 $category_id = (int) Yii::app()->request->getPost("category_id");
                 $action = Yii::app()->request->getPost("action");
                 $sresult = profilecategoryview($category_id);
                 // only use in view_editcompany
                 $aData['category_id'] = $category_id;
                 $aData['mur'] = $sresult;
                 $this->_renderWrappedTemplate('panellist/category', 'editcategory_view', $aData);
                 return;
             }
         }
     }
     Yii::app()->setFlashMessage(Yii::app()->lang->gT("You do not have sufficient rights to access this page."), 'error');
     $this->getController()->redirect(array("admin/profilecategory/index"));
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:55,代码来源:profilecategory.php


示例5: insertlabelset

function insertlabelset()
{
    $postlabel_name = flattenText(Yii::app()->getRequest()->getPost('label_name'), false, true, 'UTF-8', true);
    $data = array('label_name' => $postlabel_name, 'languages' => sanitize_languagecodeS(implode(' ', Yii::app()->getRequest()->getPost('languageids', array('en')))));
    $result = LabelSet::model()->insertRecords($data);
    if (!$result) {
        Yii::app()->session['flashmessage'] = gT("Inserting the label set failed.");
    } else {
        return $result;
    }
}
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:11,代码来源:label_helper.php


示例6: getAllSets

 public function getAllSets()
 {
     $results = LabelSet::model()->findAll();
     $output = array();
     foreach ($results as $row) {
         $output[$row->lid] = flattenText($row->getAttribute('label_name'));
     }
     header('Content-type: application/json');
     echo ls_json_encode($output);
 }
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:10,代码来源:labels.php


示例7: mod

 function mod()
 {
     $clang = Yii::app()->lang;
     $action = isset($_POST['action']) ? $_POST['action'] : '';
     $aData = array();
     $aViewUrls = array();
     if (Permission::model()->hasGlobalPermission('panellist', 'update')) {
         $query_id = (int) Yii::app()->request->getPost("query_id");
         if ($action == "editquery") {
             if (isquerysent($query_id)) {
                 Yii::app()->setFlashMessage(Yii::app()->lang->gT("You can not update this query. This query has been sent."), 'error');
                 $this->getController()->redirect(array("admin/pquery/index"));
                 return 1;
             }
             // $query_id = (int) Yii::app()->request->getPost("query_id");
             $title = flattenText($_POST['query_title'], false, true, 'UTF-8', true);
             $project_id = (int) Yii::app()->request->getPost("project_id");
             $qstring = addslashes($_POST['query_sql']);
             $zip = trim($_POST['zipcode']);
             $age = $_POST['toage'] . "," . $_POST['fromage'];
             $country = (int) Yii::app()->request->getPost("country");
             $total_panellists = (int) Yii::app()->request->getPost("total_panellists");
             $user_id = Yii::app()->user->id;
             $created_date = Date('y-m-d h:i:s');
             $modified_date = Date('y-m-d h:i:s');
             $sql_insert = "update {{query_master}} set\n                        name ='{$title}'\n                        ,qstring ='{$qstring}'\n                        ,project_id= {$project_id}\n                        ,zip='{$zip}'\n                        ,age ='{$age}'\n                        ,country={$country}\n                        ,total_panellists={$total_panellists}\n                        ,modified_date ='{$modified_date}'\n                        where id= {$query_id}";
             $rString = Yii::app()->db->createCommand($sql_insert)->query();
             $delquery = "Delete from {{query_detail}} where query_id = " . $query_id;
             $dString = Yii::app()->db->createCommand($delquery)->query();
             if (isset($_POST['query_detail'])) {
                 foreach ($_POST['query_detail'] as $question_id => $answer_id) {
                     if (is_array($answer_id)) {
                         foreach ($answer_id as $answer) {
                             $insertQuery = "insert into {{query_detail}} set\n                                                            query_id = '" . $query_id . "',\n                                                            question_id = '" . $question_id . "',\n                                                            answer_id = '" . $answer . "'";
                             $rString = Yii::app()->db->createCommand($insertQuery)->query();
                         }
                     } else {
                         $insertQuery = "insert into {{query_detail}} set\n                                                            query_id = '" . $query_id . "',\n                                                            question_id = '" . $question_id . "',\n                                                            answer_id = '" . $answer_id . "'";
                         $rString = Yii::app()->db->createCommand($insertQuery)->query();
                     }
                 }
             }
             Yii::app()->setFlashMessage($clang->gT("Query Updated successfully"));
             if ($_POST['pid'] != '') {
                 $pid = $_POST['pid'];
                 $vid = $_POST['vid'];
                 //echo '<script>$.fancybox.close()</script>;';
                 $this->getController()->redirect(array("admin/project/sa/modifyproject/project_id/{$pid}/action/modifyvendor/vid/{$vid}"));
             } else {
                 $this->getController()->redirect(array("admin/pquery/index"));
             }
             //$this->getController()->redirect(array("admin/pquery/index"));
         } else {
             if (isset($_POST['query_id'])) {
                 $aData['row'] = 0;
                 $aData['usr_arr'] = array();
                 $project_id = isset($_GET['prjid']) ? $_GET['prjid'] : '';
                 $aData['prjid'] = $project_id;
                 $vid = isset($_GET['vid']) ? $_GET['vid'] : '';
                 $aData['vid'] = $vid;
                 $query_id = (int) Yii::app()->request->getPost("query_id");
                 $action = Yii::app()->request->getPost("action");
                 $sresult = queryview($query_id);
                 $aData['query_id'] = $query_id;
                 $aData['mur'] = $sresult;
                 $this->_renderWrappedTemplate('panellist/query', 'editquery_view', $aData);
                 return;
             }
         }
     }
     Yii::app()->setFlashMessage(Yii::app()->lang->gT("You do not have sufficient rights to access this page."), 'error');
     $this->getController()->redirect(array("admin/pquery/index"));
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:73,代码来源:queries.php


示例8: _createNewUser

 /**
  * Create a LDAP user
  *
  * @param string $new_user
  * @return null|string New user ID
  */
 private function _createNewUser($new_user)
 {
     $oEvent = $this->getEvent();
     // Get configuration settings:
     $ldapserver = $this->get('server');
     $ldapport = $this->get('ldapport');
     $ldapmode = $this->get('ldapmode');
     $searchuserattribute = $this->get('searchuserattribute');
     $extrauserfilter = $this->get('extrauserfilter');
     $usersearchbase = $this->get('usersearchbase');
     $binddn = $this->get('binddn');
     $bindpwd = $this->get('bindpwd');
     $mailattribute = $this->get('mailattribute');
     $fullnameattribute = $this->get('fullnameattribute');
     // Try to connect
     $ldapconn = $this->createConnection();
     if (!is_resource($ldapconn)) {
         $oEvent->set('errorCode', self::ERROR_LDAP_CONNECTION);
         $oEvent->set('errorMessageTitle', '');
         $oEvent->set('errorMessageBody', $ldapconn['errorMessage']);
         return null;
     }
     if (empty($ldapmode) || $ldapmode == 'simplebind') {
         $oEvent->set('errorCode', self::ERROR_LDAP_MODE);
         $oEvent->set('errorMessageTitle', gT("Failed to add user"));
         $oEvent->set('errorMessageBody', gT("Simple bind LDAP configuration doesn't allow LDAP user creation"));
         return null;
     }
     // Search email address and full name
     if (empty($binddn)) {
         // There is no account defined to do the LDAP search,
         // let's use anonymous bind instead
         $ldapbindsearch = @ldap_bind($ldapconn);
     } else {
         // An account is defined to do the LDAP search, let's use it
         $ldapbindsearch = @ldap_bind($ldapconn, $binddn, $bindpwd);
     }
     if (!$ldapbindsearch) {
         $oEvent->set('errorCode', self::ERROR_LDAP_NO_BIND);
         $oEvent->set('errorMessageTitle', gT('Could not connect to LDAP server.'));
         $oEvent->set('errorMessageBody', gT(ldap_error($ldapconn)));
         ldap_close($ldapconn);
         // all done? close connection
         return null;
     }
     // Now prepare the search fitler
     if ($extrauserfilter != "") {
         $usersearchfilter = "(&({$searchuserattribute}={$new_user}){$extrauserfilter})";
     } else {
         $usersearchfilter = "({$searchuserattribute}={$new_user})";
     }
     // Search for the user
     $dnsearchres = ldap_search($ldapconn, $usersearchbase, $usersearchfilter, array($mailattribute, $fullnameattribute));
     $rescount = ldap_count_entries($ldapconn, $dnsearchres);
     if ($rescount == 1) {
         $userentry = ldap_get_entries($ldapconn, $dnsearchres);
         $new_email = flattenText($userentry[0][$mailattribute][0]);
         $new_full_name = flattenText($userentry[0][strtolower($fullnameattribute)][0]);
     } else {
         $oEvent->set('errorCode', self::ERROR_LDAP_NO_SEARCH_RESULT);
         $oEvent->set('errorMessageTitle', gT('Username not found in LDAP server'));
         $oEvent->set('errorMessageBody', gT('Verify username and try again'));
         ldap_close($ldapconn);
         // all done? close connection
         return null;
     }
     if (!validateEmailAddress($new_email)) {
         $oEvent->set('errorCode', self::ERROR_INVALID_EMAIL);
         $oEvent->set('errorMessageTitle', gT("Failed to add user"));
         $oEvent->set('errorMessageBody', gT("The email address is not valid."));
         return null;
     }
     $new_pass = createPassword();
     // If user is being auto created we set parent ID to 1 (admin user)
     if (isset(Yii::app()->session['loginID'])) {
         $parentID = Yii::app()->session['loginID'];
     } else {
         $parentID = 1;
     }
     $iNewUID = User::model()->insertUser($new_user, $new_pass, $new_full_name, $parentID, $new_email);
     if (!$iNewUID) {
         $oEvent->set('errorCode', self::ERROR_ALREADY_EXISTING_USER);
         $oEvent->set('errorMessageTitle', '');
         $oEvent->set('errorMessageBody', gT("Failed to add user"));
         return null;
     }
     Permission::model()->setGlobalPermission($iNewUID, 'auth_ldap');
     $oEvent->set('newUserID', $iNewUID);
     $oEvent->set('newPassword', $new_pass);
     $oEvent->set('newEmail', $new_email);
     $oEvent->set('newFullName', $new_full_name);
     $oEvent->set('errorCode', self::ERROR_NONE);
     return $iNewUID;
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:100,代码来源:AuthLDAP.php


示例9: getReportData

 /**
  * @param $surveysToInclude the names of all the programs we want to generate reports for
  * @return array the data we need to generate a report
  */
 private function getReportData($surveysToInclude, $featureYear)
 {
     //Array to hold all surveys to Return
     $surveys = array();
     foreach ($surveysToInclude as $surveyID) {
         /**GENERAL SURVEY DATA**/
         //Holds general data about current survey
         $surveyData = array();
         //Get program associated with this survey
         $programEnrollment = $this->api->newModel($this, 'program_enrollment');
         $surveyProgramData = $programEnrollment->find('survey_id=:sid', array(':sid' => $surveyID));
         $surveyData['programTitle'] = $surveyProgramData["programName"];
         //Get program title ready to pass to query
         $programTitle = $this->sanitizeForSql($surveyData['programTitle']);
         //Get program data
         $program = Yii::app()->db->createCommand("SELECT * FROM {{community_action_programs}}\n                     WHERE programName = '{$programTitle}'")->query()->read();
         $surveyData['programDescription'] = $program["description"];
         //Get surveys title
         $surveyData['title'] = $this->getSurveyTitle($surveyID);
         //Check for if this survey uses tokens
         if (!is_null(Yii::app()->db->schema->getTable("{{tokens_{$surveyID}}}"))) {
             //Get total # of tokens created for this survey
             $tokensCreated = Yii::app()->db->createCommand("Select COUNT(*) as tokensCreated\n                FROM {{tokens_{$surveyID}}}\n                WHERE sent NOT LIKE 'N'\n                AND YEAR(sent) = {$featureYear}")->query()->read();
             $surveyData['tokenCount'] = $tokensCreated["tokensCreated"];
         }
         /**QUESTION GROUP DATA**/
         $surveyData['questionGroups'] = array();
         //Get all registered question groups and loop getting questions associated with it
         $registeredQuestionGroups = Yii::app()->db->createCommand("SELECT cg.group_name, cg.description, cg.include_in_report\n                           FROM {{community_action_report_question_groups}} cg")->query();
         foreach ($registeredQuestionGroups->readAll() as $currentQuestionGroup) {
             //Check if registered question group should be included in report
             if ($currentQuestionGroup['include_in_report']) {
                 //If question group is supposed to be included continue
                 /**GENERAL Question Group Data**/
                 $currentQuestionGroupData = array();
                 $currentQuestionGroupData['questionGroupTitle'] = $currentQuestionGroup['group_name'];
                 $currentQuestionGroupData['description'] = $currentQuestionGroup['description'];
                 $currentQuestionGroupData['questions'] = array();
                 /** Question Group associated QUESTION and RESPONSES */
                 //Sanitize question group name before passing to query
                 $currentQuestionGroupTitle = $this->sanitizeForSql($currentQuestionGroup['group_name']);
                 //Get all questions associated with current survey and question group
                 $query = "SELECT\n                      q.sid, q.gid, q.qid, q.question\n                      FROM {{questions}} q\n                      INNER JOIN {{groups}} g ON g.gid = q.gid\n                      WHERE q.sid = {$surveyID}\n                      AND g.group_name = '{$currentQuestionGroupTitle}'\n                      GROUP BY q.qid";
                 $results = Yii::app()->db->createCommand($query)->query();
                 // Loop through all questions for current Question Group
                 foreach ($results->readAll() as $questionRow) {
                     //This holds general information about each question
                     $questionData = array();
                     $questionData['title'] = flattenText($questionRow['question']);
                     $questionData['possibleAnswers'] = array();
                     //Determine this questions column name in DB
                     $questionDBColumnName = $questionRow['sid'] . 'X' . $questionRow['gid'] . 'X' . $questionRow['qid'];
                     //Figure out if question is optional
                     $optionalAnswerCount = Yii::app()->db->createCommand("SELECT COUNT(*) AS 'count'\n                         FROM {{survey_{$surveyID}}}\n                         WHERE `{$questionDBColumnName}` = ''")->query()->read();
                     if ($optionalAnswerCount['count'] > 0) {
                         $questionData['isOptional'] = 'true';
                         array_push($questionData['possibleAnswers'], 'No answer');
                     } else {
                         $questionData['isOptional'] = 'false';
                     }
                     //Get all years of valid data
                     $yearsOfData = Yii::app()->db->createCommand("SELECT DISTINCT(year(submitdate)) as 'year' FROM {{survey_{$surveyID}}}")->query();
                     $firstYear = true;
                     //Loop on each question for each valid year
                     foreach ($yearsOfData->readAll() as $year) {
                         //get current year
                         $currentYear = $year['year'];
                         // *** Get all possible answers for current question ***
                         //TODO draw this out of year loop inefficient to do this every time
                         $answersResults = Yii::app()->db->createCommand(" SELECT `code` AS AnswerValue, answer AS AnswerText\n                              FROM {{answers}}\n                              WHERE qid = " . $questionRow['qid'])->query();
                         //Read first result
                         $currentAnswer = $answersResults->read();
                         // *** Get Survey Responses for this year ***
                         $responsesResults = Yii::app()->db->createCommand("SELECT  `" . $questionDBColumnName . "`AS AnswerValue, COUNT(*) AS `Count` FROM {{survey_{$surveyID}}}\n                        WHERE YEAR(submitdate) = {$currentYear}\n                        GROUP BY `" . $questionDBColumnName . "`")->query();
                         //Holds current questions response data by year in a graph-able format
                         $answerCount = array();
                         //Loop through all returned user results
                         $firstResponse = true;
                         foreach ($responsesResults->readAll() as $responseRow) {
                             // Must have this check for if the question was optional and has no answer result
                             if ($responseRow['AnswerValue'] == "") {
                                 array_push($answerCount, array('A0' => (int) $responseRow['Count']));
                             } else {
                                 if ($questionData['isOptional'] == 'true' && $firstResponse) {
                                     array_push($answerCount, array('A0' => 0));
                                 }
                                 //Fill Data Holes until next answer has value
                                 while ($responseRow['AnswerValue'] != $currentAnswer['AnswerValue'] && $currentAnswer) {
                                     array_push($answerCount, array($currentAnswer['AnswerValue'] => 0));
                                     if ($firstYear) {
                                         array_push($questionData['possibleAnswers'], $currentAnswer['AnswerText']);
                                     }
                                     $currentAnswer = $answersResults->read();
                                 }
                                 //Push valid answer count and value if it exists
                                 if ($currentAnswer) {
//.........这里部分代码省略.........
开发者ID:schreinerkw,项目名称:CommunityActionProject,代码行数:101,代码来源:Report.php


示例10: getQuestionReplacement

 /**
  * Construction of replacement array, actually doing it with redata
  *
  * @param $aQuestionQanda : array from qanda helper
  * @return aray of replacement for question.psptl
  **/
 public static function getQuestionReplacement($aQuestionQanda)
 {
     // Get the default replacement and set empty value by default
     $aReplacement = array("QID" => "", "SGQ" => "", "AID" => "", "QUESTION_CODE" => "", "QUESTION_NUMBER" => "", "QUESTION" => "", "QUESTION_TEXT" => "", "QUESTIONHELP" => "", "QUESTIONHELPPLAINTEXT" => "", "QUESTION_CLASS" => "", "QUESTION_MAN_CLASS" => "", "QUESTION_INPUT_ERROR_CLASS" => "", "ANSWER" => "", "QUESTION_HELP" => "", "QUESTION_VALID_MESSAGE" => "", "QUESTION_FILE_VALID_MESSAGE" => "", "QUESTION_MAN_MESSAGE" => "", "QUESTION_MANDATORY" => "", "QUESTION_ESSENTIALS" => "");
     if (!is_array($aQuestionQanda) || empty($aQuestionQanda[0])) {
         return $aReplacement;
     }
     $iQid = $aQuestionQanda[4];
     $lemQuestionInfo = LimeExpressionManager::GetQuestionStatus($iQid);
     $iSurveyId = Yii::app()->getConfig('surveyID');
     // Or : by SGQA of question ? by Question::model($iQid)->sid;
     $oSurveyId = Survey::model()->findByPk($iSurveyId);
     $sType = $lemQuestionInfo['info']['type'];
     // Core value : not replaced
     $aReplacement['QID'] = $iQid;
     $aReplacement['GID'] = $aQuestionQanda[6];
     // Not sure for aleatory : it's the real gid or the updated gid ? We need original gid or updated gid ?
     $aReplacement['SGQ'] = $aQuestionQanda[7];
     $aReplacement['AID'] = isset($aQuestionQanda[0]['aid']) ? $aQuestionQanda[0]['aid'] : "";
     $aReplacement['QUESTION_CODE'] = $aReplacement['QUESTION_NUMBER'] = "";
     $sCode = $aQuestionQanda[5];
     $iNumber = $aQuestionQanda[0]['number'];
     switch (Yii::app()->getConfig('showqnumcode')) {
         case 'both':
             $aReplacement['QUESTION_CODE'] = $sCode;
             $aReplacement['QUESTION_NUMBER'] = $iNumber;
             break;
         case 'number':
             $aReplacement['QUESTION_NUMBER'] = $iNumber;
             break;
         case 'number':
             $aReplacement['QUESTION_CODE'] = $sCode;
             break;
         case 'choose':
         default:
             switch ($oSurveyId->showqnumcode) {
                 case 'B':
                     // Both
                     $aReplacement['QUESTION_CODE'] = $sCode;
                     $aReplacement['QUESTION_NUMBER'] = $iNumber;
                     break;
                 case 'N':
                     $aReplacement['QUESTION_NUMBER'] = $iNumber;
                     break;
                 case 'C':
                     $aReplacement['QUESTION_CODE'] = $sCode;
                     break;
                 case 'X':
                 default:
                     break;
             }
             break;
     }
     $aReplacement['QUESTION'] = $aQuestionQanda[0]['all'];
     // Deprecated : only used in old template (very old)
     // Core value : user text
     $aReplacement['QUESTION_TEXT'] = $aQuestionQanda[0]['text'];
     $aReplacement['QUESTIONHELP'] = $lemQuestionInfo['info']['help'];
     // User help
     // To be moved in a extra plugin : QUESTIONHELP img adding
     $sTemplateDir = Template::model()->getTemplatePath($oSurveyId->template);
     $sTemplateUrl = Template::model()->getTemplateURL($oSurveyId->template);
     if (flattenText($aReplacement['QUESTIONHELP'], true, true) != '') {
         $aReplacement['QUESTIONHELP'] = Yii::app()->getController()->renderPartial('/survey/system/questionhelp/questionhelp', array('questionHelp' => $aReplacement['QUESTIONHELP']), true);
     }
     // Core value :the classes
     $aReplacement['QUESTION_CLASS'] = Question::getQuestionClass($sType);
     //get additional question classes from question attribute
     $aQuestionAttributes = getQuestionAttributeValues($aQuestionQanda[4]);
     //add additional classes
     if (isset($aQuestionAttributes['cssclass'])) {
         $aReplacement['QUESTION_CLASS'] .= " " . $aQuestionAttributes['cssclass'];
     }
     $aMandatoryClass = array();
     if ($lemQuestionInfo['info']['mandatory'] == 'Y') {
         $aMandatoryClass[] = 'mandatory';
     }
     if ($lemQuestionInfo['anyUnanswered'] && $_SESSION['survey_' . $iSurveyId]['maxstep'] != $_SESSION['survey_' . $iSurveyId]['step']) {
         $aMandatoryClass[] = 'missing';
     }
     $aReplacement['QUESTION_MAN_CLASS'] = !empty($aMandatoryClass) ? " " . implode(" ", $aMandatoryClass) : "";
     $aReplacement['QUESTION_INPUT_ERROR_CLASS'] = $aQuestionQanda[0]['input_error_class'];
     // Core value : LS text : EM and not
     $aReplacement['ANSWER'] = $aQuestionQanda[1];
     $aReplacement['QUESTION_HELP'] = $aQuestionQanda[0]['help'];
     // Core help only, not EM
     $aReplacement['QUESTION_VALID_MESSAGE'] = $aQuestionQanda[0]['valid_message'];
     // $lemQuestionInfo['validTip']
     $aReplacement['QUESTION_FILE_VALID_MESSAGE'] = $aQuestionQanda[0]['file_valid_message'];
     // $lemQuestionInfo['??']
     $aReplacement['QUESTION_MAN_MESSAGE'] = $aQuestionQanda[0]['man_message'];
     $aReplacement['QUESTION_MANDATORY'] = $aQuestionQanda[0]['mandatory'];
     // For QUESTION_ESSENTIALS
     $aHtmlOptions = array();
//.........这里部分代码省略.........
开发者ID:BertHankes,项目名称:LimeSurvey,代码行数:101,代码来源:SurveyRuntimeHelper.php


示例11: actionView


//.........这里部分代码省略.........
     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_') {
             $sOutput .= "\t<tr class='printanswersquestionhead'><td colspan='2'>{$fname[0]}</td></tr>\n";
         } elseif ($sFieldname == 'submitdate') {
             if ($sAnonymized != 'Y') {
                 $sOutput .= "\t<tr class='printanswersquestion'><td>{$fname[0]} {$fname[1]} {$sFieldname}</td><td class='printanswersanswertext'>{$fname[2]}</td></tr>";
             }
         } else {
             $sOutput .= "\t<tr class='printanswersquestion'><td>{$fname[0]} {$fname[1]}</td><td class='printanswersanswertext'>" . flattenText($fname[2]) . "</td></tr>";
         }
     }
     $sOutput .= "</table>\n";
     $sData['thissurvey'] = $aSurveyInfo;
     $sOutput = templatereplace($sOutput, array(), $sData, '', $aSurveyInfo['anonymized'] == "Y", NULL, array(), true);
     // Do a static replacement
     if ($sExportType == 'pdf') {
         $oPDF->writeHTML($sOutput);
         header("Pragma: public");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         $sExportFileName = sanitize_filename($sSurveyName);
         $oPDF->Output($sExportFileName . "-" . $iSurveyID . ".pdf", "D");
     } else {
         ob_start(function ($buffer, $phase) {
             App()->getClientScript()->render($buffer);
             App()->getClientScript()->reset();
             return $buffer;
         });
         ob_implicit_flush(false);
         sendCacheHeaders();
         doHeader();
         echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/startpage.pstpl'), array(), $sData);
         echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/printanswers.pstpl'), array('ANSWERTABLE' => $sOutput), $sData);
         echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/endpage.pstpl'), array(), $sData);
         echo "</body></html>";
         ob_flush();
     }
     LimeExpressionManager::FinishProcessingGroup();
     LimeExpressionManager::FinishProcessingPage();
 }
开发者ID:josetorerobueno,项目名称:test_repo,代码行数:101,代码来源:PrintanswersController.php


示例12: _showSpeaker

 private function _showSpeaker($hinttext)
 {
     global $max;
     $clang = Yii::app()->lang;
     $imageurl = Yii::app()->getConfig("adminimageurl");
     if (!isset($max)) {
         $max = 20;
     }
     $htmlhinttext = str_replace("'", '&#039;', $hinttext);
     //the string is already HTML except for single quotes so we just replace these only
     $jshinttext = javascriptEscape($hinttext, true, true);
     if (strlen(html_entity_decode($hinttext, ENT_QUOTES, 'UTF-8')) > $max + 3) {
         $shortstring = flattenText($hinttext, true);
         $shortstring = htmlspecialchars(mb_strcut(html_entity_decode($shortstring, ENT_QUOTES, 'UTF-8'), 0, $max, 'UTF-8'));
         //output with hoover effect
         $reshtml = "<span style='cursor: hand' alt='" . $htmlhinttext . "' title='" . $htmlhinttext . "' " . " onclick=\"alert('" . $clang->gT("Question", "js") . ": {$jshinttext}')\" />" . " \"{$shortstring}...\" </span>" . "<img style='cursor: hand' src='{$imageurl}/speaker.png' align='bottom' alt='{$htmlhinttext}' title='{$htmlhinttext}' " . " onclick=\"alert('" . $clang->gT("Question", "js") . ": {$jshinttext}')\" />";
     } else {
         $shortstring = flattenText($hinttext, true);
         $reshtml = "<span title='" . $shortstring . "'> \"{$shortstring}\"</span>";
     }
     return $reshtml;
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:22,代码来源:conditionsaction.php


示例13: foreach

    <?php $clang->eT("To reorder questions/questiongroups just drag the question/group with your mouse to the desired position.");?><br />
    <?php $clang->eT("After you are done please click the bottom 'Save' button to save your changes.");?>
</p>
<div class='movableList'>
    <ol class="organizer group-list" data-level='group'>
        <?php
            foreach ($aGroupsAndQuestions as  $aGroupAndQuestions)
            {?>
            <li id='list_g<?php echo $aGroupAndQuestions['gid'];?>' class='group-item' data-level='group'><div class='ui-widget-header'> <?php echo flattenText($aGroupAndQuestions['group_name'],true);?></div>
                <?php if (isset ($aGroupAndQuestions['questions']))
                    {?>
                    <ol class='question-list' data-level='question'>
                        <?php
                            foreach($aGroupAndQuestions['questions'] as $aQuestion)
                            {?>
                            <li id='list_q<?php echo $aQuestion['qid'];?>' class='question-item' data-level='question'><div><b><a href='<?php echo Yii::app()->getController()->createUrl('admin/questions/sa/editquestion/surveyid/'.$surveyid.'/gid/'.$aQuestion['gid'].'/qid/'.$aQuestion['qid']);?>'><?php echo $aQuestion['title'];?></a></b>: <?php echo flattenText($aQuestion['question'],true);?></div></li>

                            <?php }?>
                    </ol>
                    <?php }?>
            </li>
            <?php
        }?>
    </ol>
</div>
<?php echo CHtml::form(array("admin/survey/sa/organize/surveyid/{$surveyid}"), 'post', array('id'=>'frmOrganize')); ?>
    <p>
        <input type='hidden' id='orgdata' name='orgdata' value='' />
        <button id='btnSave'><?php echo $clang->eT('Save'); ?></button>
    </p>
</form>
开发者ID:rouben,项目名称:LimeSurvey,代码行数:31,代码来源:organizeGroupsAndQuestions_view.php


示例14: addAnswer

 /**
  *
  * Add answer to PDF
  *
  * @param $sQuestion - Question field text array
  * @param $sResponse - Answer field text array
  * @param $bReplaceExpressions - Try to replace LimeSurvey Expressions. This is false when exporting answers PDF from admin GUI
  *                               because we can not interpret expressions so just purify.
  *                               TODO: Find a universal valid method to interpret expressions
  * @param $bAllowBreakPage - Allow break cell in two pages
  * @return unknown_type
  */
 function addAnswer($sQuestion, $sResponse, $bReplaceExpressions = true, $bAllowBreakPage = false)
 {
     $oPurifier = new CHtmlPurifier();
     $sQuestionHTML = str_replace('-oth-', '', $sQuestion);
     // Copied from Writer::stripTagsFull. Really necessary?
     $sQuestionHTML = html_entity_decode(stripJavaScript($oPurifier->purify($sQuestionHTML)), ENT_COMPAT);
     if ($bReplaceExpressions) {
         $sData['thissurvey'] = $this->_aSurveyInfo;
         $sQuestionHTML = templatereplace($sQuestionHTML, array(), $sData, '', $this->_aSurveyInfo['anonymized'] == "Y", NULL, array(), true);
     }
     $sResponse = flattenText($sResponse, false, true, 'UTF-8', false);
     $startPage = $this->getPage();
     $this->startTransaction();
     $this->SetFontSize($this->_ibaseAnswer 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP floatVal函数代码示例发布时间:2022-05-15
下一篇:
PHP flatten函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap