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


PHP learnpath::escape_string方法代码示例

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


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

示例1: add_lp

 /**
  * Static admin function allowing addition of a learnpath to a course.
  * @param	string	Course code
  * @param	string	Learnpath name
  * @param	string	Learnpath description string, if provided
  * @param	string	Type of learnpath (default = 'guess', others = 'dokeos', 'aicc',...)
  * @param	string	Type of files origin (default = 'zip', others = 'dir','web_dir',...)
  * @param	string	Zip file containing the learnpath or directory containing the learnpath
  * @param	string	Keyword tags to add to the document
  * @return	integer	The new learnpath ID on success, 0 on failure
  */
 function add_lp($course, $name, $description = '', $learnpath = 'guess', $origin = 'zip', $zipname = '', $keyword = '')
 {
     global $charset;
     //if($this->debug>0){error_log('New LP - In learnpath::add_lp()',0);}
     //TODO
     $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
     //check course code exists
     //check lp_name doesn't exist, otherwise append something
     $i = 0;
     $name = learnpath::escape_string($name);
     //session_id
     $session_id = api_get_session_id();
     $check_name = "SELECT * FROM {$tbl_lp} WHERE name = '{$name}'";
     //if($this->debug>2){error_log('New LP - Checking the name for new LP: '.$check_name,0);}
     $res_name = Database::query($check_name, __FILE__, __LINE__);
     while (Database::num_rows($res_name)) {
         //there is already one such name, update the current one a bit
         $i++;
         $name = $name . ' - ' . $i;
         $check_name = "SELECT * FROM {$tbl_lp} WHERE name = '{$name}'";
         //if($this->debug>2){error_log('New LP - Checking the name for new LP: '.$check_name,0);}
         $res_name = Database::query($check_name, __FILE__, __LINE__);
     }
     //new name does not exist yet; keep it
     //escape description
     $description = learnpath::escape_string(api_htmlentities($description, ENT_QUOTES, $charset));
     //Kevin: added htmlentities()
     $type = 1;
     switch ($learnpath) {
         case 'guess':
             break;
         case 'dokeos':
             $type = 1;
             break;
         case 'aicc':
             break;
     }
     switch ($origin) {
         case 'zip':
             //check zipname string. If empty, we are currently creating a new Dokeos learnpath
             break;
         case 'manual':
         default:
             $get_max = "SELECT MAX(display_order) FROM {$tbl_lp}";
             $res_max = Database::query($get_max, __FILE__, __LINE__);
             if (Database::num_rows($res_max) < 1) {
                 $dsp = 1;
             } else {
                 $row = Database::fetch_array($res_max);
                 $dsp = $row[0] + 1;
             }
             $sql_insert = "INSERT INTO {$tbl_lp} " . "(lp_type,name,description,path,default_view_mod," . "default_encoding,display_order,content_maker," . "content_local,js_lib,session_id) " . "VALUES ({$type},'{$name}','{$description}','','embedded'," . "'UTF-8','{$dsp}','Dokeos'," . "'local','','" . Database::escape_string($session_id) . "')";
             //if($this->debug>2){error_log('New LP - Inserting new lp '.$sql_insert,0);}
             $res_insert = Database::query($sql_insert, __FILE__, __LINE__);
             $id = Database::insert_id();
             if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
                 //save search engine keyword
                 $searchkey = new SearchEngineManager();
                 $searchkey->idobj = $id;
                 $searchkey->course_code = api_get_course_id();
                 $searchkey->tool_id = TOOL_LEARNPATH;
                 $searchkey->value = $keyword;
                 $searchkey->save();
                 $lp = new learnpath(api_get_course_id(), $id, api_get_user_id());
                 $lp->search_engine_save();
             }
             if ($id > 0) {
                 //insert into item_property
                 api_item_property_update(api_get_course_info(), TOOL_LEARNPATH, $id, 'LearnpathAdded', api_get_user_id());
                 return $id;
             }
             break;
     }
 }
开发者ID:Eidn,项目名称:shanghai,代码行数:85,代码来源:learnpath.class.php

示例2: array

$errors = array(0 => 'Successful', 1 => 'Invalid Command', 2 => 'Invalid AU password', 3 => 'Invalid Session ID');
$error_code = 0;
$error_text = '';
$aicc_data = '';
$result = '';
//GET REQUEST
if (!empty($_REQUEST['command'])) {
    //error_log('In '.__FILE__.', '.__LINE__.' - request is '.$_REQUEST['command'],0);
    switch (strtolower($_REQUEST['command'])) {
        case 'getparam':
            //request for all available data to be printed out in the answer
            if (!empty($_REQUEST['version'])) {
                $hacp_version = learnpath::escape_string($_REQUEST['version']);
            }
            if (!empty($_REQUEST['session_id'])) {
                $hacp_session_id = learnpath::escape_string($_REQUEST['session_id']);
            }
            $error_code = 0;
            $error_text = $errors[$error_code];
            $result = $s_ec . $error_code . $crlf . $s_et . $error_text . $crlf . $s_ad . $crlf;
            $result .= '[Core]' . $crlf;
            $result .= $tab . 'Student_ID=' . $_user['user_id'] . $crlf;
            $result .= $tab . 'Student_Name=' . api_get_person_name($_user['firstName'], $_user['lastName']) . $crlf;
            $result .= $tab . 'Lesson_Location=' . $oItem->get_lesson_location() . $crlf;
            $result .= $tab . 'Credit=' . $oItem->get_credit() . $crlf;
            $result .= $tab . 'Lesson_Status=' . $oItem->get_status() . $crlf;
            $result .= $tab . 'Score=' . $oItem->get_score() . $crlf;
            $result .= $tab . 'Time=' . $oItem->get_scorm_time('js') . $crlf;
            $result .= $tab . 'Lesson_Mode=' . $oItem->get_lesson_mode() . $crlf;
            $result .= '[Core_Lesson]' . $crlf;
            $result .= $oItem->get_suspend_data() . $crlf;
开发者ID:Eidn,项目名称:shanghai,代码行数:31,代码来源:aicc_hacp.php

示例3: get_scorm_type

 /**
  * Scorm type getter
  * @return	string	generally 'asset' or 'sco' as these are the only two values defined in SCORM 1.2
  */
 function get_scorm_type()
 {
     if (!empty($this->scormtype)) {
         require_once 'learnpath.class.php';
         return learnpath::escape_string($this->scormtype);
     } else {
         return '';
     }
 }
开发者ID:Eidn,项目名称:shanghai,代码行数:13,代码来源:scormResource.class.php

示例4: urlencode

         $msg = urlencode(get_lang('cloudImportSuccess'));
     }
 }
 $content_maker = $_REQUEST['content_maker'];
 //course is uploaded to the cloud, now add it to dokeos
 require_once '../newscorm/learnpath.class.php';
 if (!isset($ScormService)) {
     $ScormService = cloud_getScormEngineService();
 }
 $courseService = $ScormService->getCourseService();
 $allResults = $courseService->GetCourseList($courseId);
 $title = $allResults[0]->getTitle();
 $tbl_lp = Database::get_course_table('lp');
 //check lp_name doesn't exist, otherwise append something
 $i = 0;
 $title = learnpath::escape_string($title);
 $newtitle = $title;
 $check_name = "SELECT * FROM {$tbl_lp} WHERE name = '{$title}'";
 //if($this->debug>2){error_log('New LP - Checking the name for new LP: '.$check_name,0);}
 $res_name = api_sql_query($check_name, __FILE__, __LINE__);
 while (Database::num_rows($res_name)) {
     //there is already one such name, update the current one a bit
     $i++;
     $newtitle = $title . ' - ' . $i;
     $check_name = "SELECT * FROM {$tbl_lp} WHERE name = '{$newtitle}'";
     //if($this->debug>2){error_log('New LP - Checking the name for new LP: '.$check_name,0);}
     $res_name = api_sql_query($check_name, __FILE__, __LINE__);
 }
 $title = $newtitle;
 //echo $title;
 $type = 2;
开发者ID:RusticiSoftware,项目名称:SCORMCloud_DokeosMod,代码行数:31,代码来源:upload.php


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