diff --git a/main/exercise/question.class.php b/main/exercise/question.class.php
index 964f79401c..ebe54b5924 100755
--- a/main/exercise/question.class.php
+++ b/main/exercise/question.class.php
@@ -2119,13 +2119,13 @@ abstract class Question
*
* @return array
*/
- static function get_course_medias(
+ public static function get_course_medias(
$course_id,
$start = 0,
$limit = 100,
$sidx = "question",
$sord = "ASC",
- $where_condition = array()
+ $where_condition = []
) {
$table_question = Database::get_course_table(TABLE_QUIZ_QUESTION);
$default_where = array(
@@ -2153,7 +2153,7 @@ abstract class Question
*
* @return int
*/
- static function get_count_course_medias($course_id)
+ public static function get_count_course_medias($course_id)
{
$table_question = Database::get_course_table(TABLE_QUIZ_QUESTION);
$result = Database::select(
diff --git a/main/gradebook/lib/fe/catform.class.php b/main/gradebook/lib/fe/catform.class.php
index d219251bf0..96f33c5900 100755
--- a/main/gradebook/lib/fe/catform.class.php
+++ b/main/gradebook/lib/fe/catform.class.php
@@ -89,22 +89,6 @@ class CatForm extends FormValidator
//check if we are a root category
//if so, you can only choose between courses
if ($this->category_object->get_parent_id() == '0') {
- $coursecat = Category::get_not_created_course_categories(
- api_get_user_id()
- );
- if (count($coursecat) == 0) {
- //$select->addoption(get_lang('CourseIndependent'),'COURSEINDEPENDENT','disabled');
- } else {
- //$select->addoption(get_lang('CourseIndependent'),'COURSEINDEPENDENT');
- }
- //only return courses that are not yet created by the teacher
- if (!empty($coursecat)) {
- foreach ($coursecat as $row) {
- //$select->addoption($row[1],$row[0]);
- }
- } else {
- //$select->addoption($row[1],$row[0]);
- }
$this->setDefaults(
array(
'select_course' => $this->category_object->get_course_code(
@@ -214,10 +198,9 @@ class CatForm extends FormValidator
$global_weight = api_get_setting('gradebook_default_weight');
+ $value = 100;
if (isset($global_weight)) {
$value = $global_weight;
- } else {
- $value = 100;
}
$this->addFloat(
@@ -231,7 +214,6 @@ class CatForm extends FormValidator
);
$skillsDefaults = [];
-
if (api_is_platform_admin() || api_is_drh()) {
if (Skill::isToolAvailable()) {
$skillSelect = $this->addElement(
@@ -401,12 +383,12 @@ class CatForm extends FormValidator
$this->addElement('submit', null, get_lang('Ok'));
}
- function display()
+ public function display()
{
parent::display();
}
- function setDefaults($defaults = array(), $filter = null)
+ public function setDefaults($defaults = array(), $filter = null)
{
parent::setDefaults($defaults, $filter);
}
diff --git a/main/gradebook/lib/fe/usertable.class.php b/main/gradebook/lib/fe/usertable.class.php
index a490ce1360..e62db0d5b9 100755
--- a/main/gradebook/lib/fe/usertable.class.php
+++ b/main/gradebook/lib/fe/usertable.class.php
@@ -16,7 +16,7 @@ class UserTable extends SortableTable
/**
* Constructor
*/
- public function __construct($userid, $evals = array(), $links = array(), $addparams = null)
+ public function __construct($userid, $evals = array(), $links = [], $addparams = null)
{
parent::__construct('userlist', null, null, 0);
$this->userid = $userid;
@@ -41,7 +41,7 @@ class UserTable extends SortableTable
/**
* Function used by SortableTable to get total number of items in the table
*/
- function get_total_number_of_items()
+ public function get_total_number_of_items()
{
return $this->datagen->get_total_items_count();
}
@@ -85,10 +85,10 @@ class UserTable extends SortableTable
}
$data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
// generate the data to display
- $sortable_data = array();
+ $sortable_data = [];
foreach ($data_array as $data) {
- if ($data[2] != "") {//filter by course removed
- $row = array();
+ if ($data[2] != '') {//filter by course removed
+ $row = [];
$row[] = $this->build_type_column($data[0]);
$row[] = $this->build_name_link($data[0]);
$row[] = $data[2];
diff --git a/main/inc/lib/xajax/xajaxResponse.inc.php b/main/inc/lib/xajax/xajaxResponse.inc.php
index 350458d5f8..1730e96616 100755
--- a/main/inc/lib/xajax/xajaxResponse.inc.php
+++ b/main/inc/lib/xajax/xajaxResponse.inc.php
@@ -67,521 +67,532 @@
*/
class xajaxResponse
{
- /**#@+
- * @access protected
- */
- /**
- * @var string internal XML storage
- */
- var $xml;
- /**
- * @var string the encoding type to use
- */
- var $sEncoding;
- /**
- * @var boolean if special characters in the XML should be converted to
- * entities
- */
- var $bOutputEntities;
-
- /**#@-*/
-
- /**
- * The constructor's main job is to set the character encoding for the
- * response.
- *
- * Note: to change the character encoding for all of the
- * responses, set the XAJAX_DEFAULT_ENCODING constant before you
- * instantiate xajax.
- *
- * @param string contains the character encoding string to use
- * @param boolean lets you set if you want special characters in the output
- * converted to HTML entities
- *
- */
- public function __construct($sEncoding=XAJAX_DEFAULT_CHAR_ENCODING, $bOutputEntities=false)
- {
- $this->setCharEncoding($sEncoding);
- $this->bOutputEntities = $bOutputEntities;
- }
-
- /**
- * Sets the character encoding for the response based on $sEncoding, which
- * is a string containing the character encoding to use. You don't need to
- * use this method normally, since the character encoding for the response
- * gets set automatically based on the XAJAX_DEFAULT_CHAR_ENCODING
- * constant.
- *
- * @param string
- */
- function setCharEncoding($sEncoding)
- {
- $this->sEncoding = $sEncoding;
- }
-
- /**
- * Tells the response object to convert special characters to HTML entities
- * automatically (only works if the mb_string extension is available).
- */
- function outputEntitiesOn()
- {
- $this->bOutputEntities = true;
- }
-
- /**
- * Tells the response object to output special characters intact. (default
- * behavior)
- */
- function outputEntitiesOff()
- {
- $this->bOutputEntities = false;
- }
-
- /**
- * Adds a confirm commands command message to the XML response.
- *
- * Usage: $objResponse->addConfirmCommands(1, "Do you want to preview the new data?");
- *
- * @param integer the number of commands to skip if the user presses
- * Cancel in the browsers's confirm dialog
- * @param string the message to show in the browser's confirm dialog
- */
- function addConfirmCommands($iCmdNumber, $sMessage)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"cc","t"=>$iCmdNumber),$sMessage);
- }
-
- /**
- * Adds an assign command message to the XML response.
- *
- * Usage: $objResponse->addAssign("contentDiv", "innerHTML", "Some Text");
- *
- * @param string contains the id of an HTML element
- * @param string the part of the element you wish to modify ("innerHTML",
- * "value", etc.)
- * @param string the data you want to set the attribute to
- */
- function addAssign($sTarget,$sAttribute,$sData)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"as","t"=>$sTarget,"p"=>$sAttribute),$sData);
- }
-
- /**
- * Adds an append command message to the XML response.
- *
- * Usage: $objResponse->addAppend("contentDiv", "innerHTML", "Some New Text");
- *
- * @param string contains the id of an HTML element
- * @param string the part of the element you wish to modify ("innerHTML",
- * "value", etc.)
- * @param string the data you want to append to the end of the attribute
- */
- function addAppend($sTarget,$sAttribute,$sData)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"ap","t"=>$sTarget,"p"=>$sAttribute),$sData);
- }
-
- /**
- * Adds an prepend command message to the XML response.
- *
- * Usage: $objResponse->addPrepend("contentDiv", "innerHTML", "Some Starting Text");
- *
- * @param string contains the id of an HTML element
- * @param string the part of the element you wish to modify ("innerHTML",
- * "value", etc.)
- * @param string the data you want to prepend to the beginning of the
- * attribute
- */
- function addPrepend($sTarget,$sAttribute,$sData)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"pp","t"=>$sTarget,"p"=>$sAttribute),$sData);
- }
-
- /**
- * Adds a replace command message to the XML response.
- *
- * Usage: $objResponse->addReplace("contentDiv", "innerHTML", "text", "text");
- *
- * @param string contains the id of an HTML element
- * @param string the part of the element you wish to modify ("innerHTML",
- * "value", etc.)
- * @param string the string to search for
- * @param string the string to replace the search string when found in the
- * attribute
- */
- function addReplace($sTarget,$sAttribute,$sSearch,$sData)
- {
- $sDta = "";
- $this->xml .= $this->_cmdXML(array("n"=>"rp","t"=>$sTarget,"p"=>$sAttribute),$sDta);
- }
-
- /**
- * Adds a clear command message to the XML response.
- *
- * Usage: $objResponse->addClear("contentDiv", "innerHTML");
- *
- * @param string contains the id of an HTML element
- * @param string the part of the element you wish to clear ("innerHTML",
- * "value", etc.)
- */
- function addClear($sTarget,$sAttribute)
- {
- $this->addAssign($sTarget,$sAttribute,'');
- }
-
- /**
- * Adds an alert command message to the XML response.
- *
- * Usage: $objResponse->addAlert("This is important information");
- *
- * @param string the text to be displayed in the Javascript alert box
- */
- function addAlert($sMsg)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"al"),$sMsg);
- }
-
- /**
- * Uses the addScript() method to add a Javascript redirect to another URL.
- *
- * Usage: $objResponse->addRedirect("http://www.xajaxproject.org");
- *
- * @param string the URL to redirect the client browser to
- */
- function addRedirect($sURL)
- {
- //we need to parse the query part so that the values are rawurlencode()'ed
- //can't just use parse_url() cos we could be dealing with a relative URL which
- // parse_url() can't deal with.
- $queryStart = strpos($sURL, '?', strrpos($sURL, '/'));
- if ($queryStart !== FALSE)
- {
- $queryStart++;
- $queryEnd = strpos($sURL, '#', $queryStart);
- if ($queryEnd === FALSE)
- $queryEnd = strlen($sURL);
- $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
+ /**#@+
+ * @access protected
+ */
+ /**
+ * @var string internal XML storage
+ */
+ var $xml;
+ /**
+ * @var string the encoding type to use
+ */
+ var $sEncoding;
+ /**
+ * @var boolean if special characters in the XML should be converted to
+ * entities
+ */
+ var $bOutputEntities;
+
+ /**#@-*/
+
+ /**
+ * The constructor's main job is to set the character encoding for the
+ * response.
+ *
+ * Note: to change the character encoding for all of the
+ * responses, set the XAJAX_DEFAULT_ENCODING constant before you
+ * instantiate xajax.
+ *
+ * @param string contains the character encoding string to use
+ * @param boolean lets you set if you want special characters in the output
+ * converted to HTML entities
+ *
+ */
+ public function __construct($sEncoding = XAJAX_DEFAULT_CHAR_ENCODING, $bOutputEntities = false)
+ {
+ $this->setCharEncoding($sEncoding);
+ $this->bOutputEntities = $bOutputEntities;
+ }
+
+ /**
+ * Sets the character encoding for the response based on $sEncoding, which
+ * is a string containing the character encoding to use. You don't need to
+ * use this method normally, since the character encoding for the response
+ * gets set automatically based on the XAJAX_DEFAULT_CHAR_ENCODING
+ * constant.
+ *
+ * @param string
+ */
+ public function setCharEncoding($sEncoding)
+ {
+ $this->sEncoding = $sEncoding;
+ }
+
+ /**
+ * Tells the response object to convert special characters to HTML entities
+ * automatically (only works if the mb_string extension is available).
+ */
+ function outputEntitiesOn()
+ {
+ $this->bOutputEntities = true;
+ }
+
+ /**
+ * Tells the response object to output special characters intact. (default
+ * behavior)
+ */
+ public function outputEntitiesOff()
+ {
+ $this->bOutputEntities = false;
+ }
+
+ /**
+ * Adds a confirm commands command message to the XML response.
+ *
+ * Usage: $objResponse->addConfirmCommands(1, "Do you want to preview the new data?");
+ *
+ * @param integer the number of commands to skip if the user presses
+ * Cancel in the browsers's confirm dialog
+ * @param string the message to show in the browser's confirm dialog
+ */
+ public function addConfirmCommands($iCmdNumber, $sMessage)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "cc", "t" => $iCmdNumber), $sMessage);
+ }
+
+ /**
+ * Adds an assign command message to the XML response.
+ *
+ * Usage: $objResponse->addAssign("contentDiv", "innerHTML", "Some Text");
+ *
+ * @param string contains the id of an HTML element
+ * @param string the part of the element you wish to modify ("innerHTML",
+ * "value", etc.)
+ * @param string the data you want to set the attribute to
+ */
+ public function addAssign($sTarget, $sAttribute, $sData)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "as", "t" => $sTarget, "p" => $sAttribute), $sData);
+ }
+
+ /**
+ * Adds an append command message to the XML response.
+ *
+ * Usage: $objResponse->addAppend("contentDiv", "innerHTML", "Some New Text");
+ *
+ * @param string contains the id of an HTML element
+ * @param string the part of the element you wish to modify ("innerHTML",
+ * "value", etc.)
+ * @param string the data you want to append to the end of the attribute
+ */
+ public function addAppend($sTarget, $sAttribute, $sData)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "ap", "t" => $sTarget, "p" => $sAttribute), $sData);
+ }
+
+ /**
+ * Adds an prepend command message to the XML response.
+ *
+ * Usage: $objResponse->addPrepend("contentDiv", "innerHTML", "Some Starting Text");
+ *
+ * @param string contains the id of an HTML element
+ * @param string the part of the element you wish to modify ("innerHTML",
+ * "value", etc.)
+ * @param string the data you want to prepend to the beginning of the
+ * attribute
+ */
+ public function addPrepend($sTarget, $sAttribute, $sData)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "pp", "t" => $sTarget, "p" => $sAttribute), $sData);
+ }
+
+ /**
+ * Adds a replace command message to the XML response.
+ *
+ * Usage: $objResponse->addReplace("contentDiv", "innerHTML", "text", "text");
+ *
+ * @param string contains the id of an HTML element
+ * @param string the part of the element you wish to modify ("innerHTML",
+ * "value", etc.)
+ * @param string the string to search for
+ * @param string the string to replace the search string when found in the
+ * attribute
+ */
+ public function addReplace($sTarget, $sAttribute, $sSearch, $sData)
+ {
+ $sDta = "";
+ $this->xml .= $this->_cmdXML(array("n" => "rp", "t" => $sTarget, "p" => $sAttribute), $sDta);
+ }
+
+ /**
+ * Adds a clear command message to the XML response.
+ *
+ * Usage: $objResponse->addClear("contentDiv", "innerHTML");
+ *
+ * @param string contains the id of an HTML element
+ * @param string the part of the element you wish to clear ("innerHTML",
+ * "value", etc.)
+ */
+ public function addClear($sTarget, $sAttribute)
+ {
+ $this->addAssign($sTarget, $sAttribute, '');
+ }
+
+ /**
+ * Adds an alert command message to the XML response.
+ *
+ * Usage: $objResponse->addAlert("This is important information");
+ *
+ * @param string the text to be displayed in the Javascript alert box
+ */
+ public function addAlert($sMsg)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "al"), $sMsg);
+ }
+
+ /**
+ * Uses the addScript() method to add a Javascript redirect to another URL.
+ *
+ * Usage: $objResponse->addRedirect("http://www.xajaxproject.org");
+ *
+ * @param string the URL to redirect the client browser to
+ */
+ public function addRedirect($sURL)
+ {
+ //we need to parse the query part so that the values are rawurlencode()'ed
+ //can't just use parse_url() cos we could be dealing with a relative URL which
+ // parse_url() can't deal with.
+ $queryStart = strpos($sURL, '?', strrpos($sURL, '/'));
+ if ($queryStart !== false) {
+ $queryStart++;
+ $queryEnd = strpos($sURL, '#', $queryStart);
+ if ($queryEnd === false) {
+ $queryEnd = strlen($sURL);
+ }
+ $queryPart = substr($sURL, $queryStart, $queryEnd - $queryStart);
$queryParts = array();
- parse_str($queryPart, $queryParts);
- $newQueryPart = "";
- foreach($queryParts as $key => $value)
- {
- $newQueryPart .= rawurlencode($key).'='.rawurlencode($value).ini_get('arg_separator.output');
- }
- $sURL = str_replace($queryPart, $newQueryPart, $sURL);
- }
- $this->addScript('window.location = "'.$sURL.'";');
- }
-
- /**
- * Adds a Javascript command message to the XML response.
- *
- * Usage: $objResponse->addScript("var x = prompt('get some text');");
- *
- * @param string contains Javascript code to be executed
- */
- function addScript($sJS)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"js"),$sJS);
- }
-
- /**
- * Adds a Javascript function call command message to the XML response.
- *
- * Usage: $objResponse->addScriptCall("myJSFunction", "arg 1", "arg 2", 12345);
- *
- * @param string $sFunc the name of a Javascript function
- * @param mixed $args,... optional arguments to pass to the Javascript function
- */
- function addScriptCall() {
- $arguments = func_get_args();
- $sFunc = array_shift($arguments);
- $sData = $this->_buildObjXml($arguments);
- $this->xml .= $this->_cmdXML(array("n"=>"jc","t"=>$sFunc),$sData);
- }
-
- /**
- * Adds a remove element command message to the XML response.
- *
- * Usage: $objResponse->addRemove("Div2");
- *
- * @param string contains the id of an HTML element to be removed
- */
- function addRemove($sTarget)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"rm","t"=>$sTarget),'');
- }
-
- /**
- * Adds a create element command message to the XML response.
- *
- * Usage: $objResponse->addCreate("parentDiv", "h3", "myid");
- *
- * @param string contains the id of an HTML element to to which the new
- * element will be appended.
- * @param string the tag to be added
- * @param string the id to be assigned to the new element
- * @param string deprecated, use the addCreateInput() method instead
- */
- function addCreate($sParent, $sTag, $sId, $sType="")
- {
- if ($sType)
- {
- trigger_error("The \$sType parameter of addCreate has been deprecated. Use the addCreateInput() method instead.", E_USER_WARNING);
- return;
- }
- $this->xml .= $this->_cmdXML(array("n"=>"ce","t"=>$sParent,"p"=>$sId),$sTag);
- }
-
- /**
- * Adds a insert element command message to the XML response.
- *
- * Usage: $objResponse->addInsert("childDiv", "h3", "myid");
- *
- * @param string contains the id of the child before which the new element
- * will be inserted
- * @param string the tag to be added
- * @param string the id to be assigned to the new element
- */
- function addInsert($sBefore, $sTag, $sId)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"ie","t"=>$sBefore,"p"=>$sId),$sTag);
- }
-
- /**
- * Adds a insert element command message to the XML response.
- *
- * Usage: $objResponse->addInsertAfter("childDiv", "h3", "myid");
- *
- * @param string contains the id of the child after which the new element
- * will be inserted
- * @param string the tag to be added
- * @param string the id to be assigned to the new element
- */
- function addInsertAfter($sAfter, $sTag, $sId)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"ia","t"=>$sAfter,"p"=>$sId),$sTag);
- }
-
- /**
- * Adds a create input command message to the XML response.
- *
- * Usage: $objResponse->addCreateInput("form1", "text", "username", "input1");
- *
- * @param string contains the id of an HTML element to which the new input
- * will be appended
- * @param string the type of input to be created (text, radio, checkbox,
- * etc.)
- * @param string the name to be assigned to the new input and the variable
- * name when it is submitted
- * @param string the id to be assigned to the new input
- */
- function addCreateInput($sParent, $sType, $sName, $sId)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"ci","t"=>$sParent,"p"=>$sId,"c"=>$sType),$sName);
- }
-
- /**
- * Adds an insert input command message to the XML response.
- *
- * Usage: $objResponse->addInsertInput("input5", "text", "username", "input1");
- *
- * @param string contains the id of the child before which the new element
- * will be inserted
- * @param string the type of input to be created (text, radio, checkbox,
- * etc.)
- * @param string the name to be assigned to the new input and the variable
- * name when it is submitted
- * @param string the id to be assigned to the new input
- */
- function addInsertInput($sBefore, $sType, $sName, $sId)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"ii","t"=>$sBefore,"p"=>$sId,"c"=>$sType),$sName);
- }
-
- /**
- * Adds an insert input command message to the XML response.
- *
- * Usage: $objResponse->addInsertInputAfter("input7", "text", "email", "input2");
- *
- * @param string contains the id of the child after which the new element
- * will be inserted
- * @param string the type of input to be created (text, radio, checkbox,
- * etc.)
- * @param string the name to be assigned to the new input and the variable
- * name when it is submitted
- * @param string the id to be assigned to the new input
- */
- function addInsertInputAfter($sAfter, $sType, $sName, $sId)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"iia","t"=>$sAfter,"p"=>$sId,"c"=>$sType),$sName);
- }
-
- /**
- * Adds an event command message to the XML response.
- *
- * Usage: $objResponse->addEvent("contentDiv", "onclick", "alert(\'Hello World\');");
- *
- * @param string contains the id of an HTML element
- * @param string the event you wish to set ("onclick", "onmouseover", etc.)
- * @param string the Javascript string you want the event to invoke
- */
- function addEvent($sTarget,$sEvent,$sScript)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"ev","t"=>$sTarget,"p"=>$sEvent),$sScript);
- }
-
- /**
- * Adds a handler command message to the XML response.
- *
- * Usage: $objResponse->addHandler("contentDiv", "onclick", "content_click");
- *
- * @param string contains the id of an HTML element
- * @param string the event you wish to set ("onclick", "onmouseover", etc.)
- * @param string the name of a Javascript function that will handle the
- * event. Multiple handlers can be added for the same event
- */
- function addHandler($sTarget,$sEvent,$sHandler)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"ah","t"=>$sTarget,"p"=>$sEvent),$sHandler);
- }
-
- /**
- * Adds a remove handler command message to the XML response.
- *
- * Usage: $objResponse->addRemoveHandler("contentDiv", "onclick", "content_click");
- *
- * @param string contains the id of an HTML element
- * @param string the event you wish to remove ("onclick", "onmouseover",
- * etc.)
- * @param string the name of a Javascript handler function that you want to
- * remove
- */
- function addRemoveHandler($sTarget,$sEvent,$sHandler)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"rh","t"=>$sTarget,"p"=>$sEvent),$sHandler);
- }
-
- /**
- * Adds an include script command message to the XML response.
- *
- * Usage: $objResponse->addIncludeScript("functions.js");
- *
- * @param string URL of the Javascript file to include
- */
- function addIncludeScript($sFileName)
- {
- $this->xml .= $this->_cmdXML(array("n"=>"in"),$sFileName);
- }
-
- /**
- * Returns the XML to be returned from your function to the xajax processor
- * on your page. Since xajax 0.2, you can also return an xajaxResponse
- * object from your function directly, and xajax will automatically request
- * the XML using this method call.
- *
- * Usage: return $objResponse->getXML();
- *
- * @return string response XML data
- */
- function getXML()
- {
- $sXML = "sEncoding && strlen(trim($this->sEncoding)) > 0)
- $sXML .= " encoding=\"".$this->sEncoding."\"";
- $sXML .= " ?".">" . $this->xml . "";
-
- return $sXML;
- }
-
- /**
- * Adds the commands of the provided response XML output to this response
- * object
- *
- * Usage:
- * $r1 = $objResponse1->getXML();
- * $objResponse2->loadXML($r1);
- * return $objResponse2->getXML();
- *
- * @param string the response XML (returned from a getXML() method) to add
- * to the end of this response object
- */
- function loadXML($mXML)
- {
- if (is_a($mXML, "xajaxResponse")) {
- $mXML = $mXML->getXML();
- }
- $sNewXML = "";
- $iStartPos = strpos($mXML, "") + 5;
- $sNewXML = substr($mXML, $iStartPos);
- $iEndPos = strpos($sNewXML, "");
- $sNewXML = substr($sNewXML, 0, $iEndPos);
- $this->xml .= $sNewXML;
- }
-
- /**
- * Generates XML from command data
- *
- * @access private
- * @param array associative array of attributes
- * @param string data
- * @return string XML command
- */
- function _cmdXML($aAttributes, $sData)
- {
- if ($this->bOutputEntities) {
- // An adaptation for the Dokeos LMS, 22-AUG-2009.
- if (function_exists('api_convert_encoding')) {
- $sData = call_user_func_array('api_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
- }
- //if (function_exists('mb_convert_encoding')) {
- elseif (function_exists('mb_convert_encoding')) {
- //
- $sData = call_user_func_array('mb_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
- }
- else {
- trigger_error("The xajax XML response output could not be converted to HTML entities because the mb_convert_encoding function is not available", E_USER_NOTICE);
- }
- }
- $xml = " $sValue)
- $xml .= " $sAttribute=\"$sValue\"";
- if ($sData !== null && !stristr($sData,'";
- else if ($sData !== null)
- $xml .= ">$sData";
- else
- $xml .= ">";
-
- return $xml;
- }
-
- /**
- * Recursively serializes a data structure in XML so it can be sent to
- * the client. It could be thought of as the opposite of
- * {@link xajax::_parseObjXml()}.
- *
- * @access private
- * @param mixed data structure to serialize to XML
- * @return string serialized XML
- */
- function _buildObjXml($var) {
- if (gettype($var) == "object") $var = get_object_vars($var);
- if (!is_array($var)) {
- return "";
- }
- else {
- $data = "";
- foreach ($var as $key => $value) {
- $data .= "";
- $data .= "" . htmlspecialchars($key) . "";
- $data .= "" . $this->_buildObjXml($value) . "";
- $data .= "";
- }
- $data .= "";
- return $data;
- }
- }
-
-}// end class xajaxResponse
-?>
+ parse_str($queryPart, $queryParts);
+ $newQueryPart = "";
+ foreach ($queryParts as $key => $value) {
+ $newQueryPart .= rawurlencode($key).'='.rawurlencode($value).ini_get('arg_separator.output');
+ }
+ $sURL = str_replace($queryPart, $newQueryPart, $sURL);
+ }
+ $this->addScript('window.location = "'.$sURL.'";');
+ }
+
+ /**
+ * Adds a Javascript command message to the XML response.
+ *
+ * Usage: $objResponse->addScript("var x = prompt('get some text');");
+ *
+ * @param string contains Javascript code to be executed
+ */
+ public function addScript($sJS)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "js"), $sJS);
+ }
+
+ /**
+ * Adds a Javascript function call command message to the XML response.
+ *
+ * Usage: $objResponse->addScriptCall("myJSFunction", "arg 1", "arg 2", 12345);
+ *
+ * @param string $sFunc the name of a Javascript function
+ * @param mixed $args,... optional arguments to pass to the Javascript function
+ */
+ public function addScriptCall()
+ {
+ $arguments = func_get_args();
+ $sFunc = array_shift($arguments);
+ $sData = $this->_buildObjXml($arguments);
+ $this->xml .= $this->_cmdXML(array("n" => "jc", "t" => $sFunc), $sData);
+ }
+
+ /**
+ * Adds a remove element command message to the XML response.
+ *
+ * Usage: $objResponse->addRemove("Div2");
+ *
+ * @param string contains the id of an HTML element to be removed
+ */
+ public function addRemove($sTarget)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "rm", "t" => $sTarget), '');
+ }
+
+ /**
+ * Adds a create element command message to the XML response.
+ *
+ * Usage: $objResponse->addCreate("parentDiv", "h3", "myid");
+ *
+ * @param string contains the id of an HTML element to to which the new
+ * element will be appended.
+ * @param string the tag to be added
+ * @param string the id to be assigned to the new element
+ * @param string deprecated, use the addCreateInput() method instead
+ */
+ public function addCreate($sParent, $sTag, $sId, $sType = "")
+ {
+ if ($sType) {
+ trigger_error(
+ "The \$sType parameter of addCreate has been deprecated. Use the addCreateInput() method instead.",
+ E_USER_WARNING
+ );
+ return;
+ }
+ $this->xml .= $this->_cmdXML(array("n" => "ce", "t" => $sParent, "p" => $sId), $sTag);
+ }
+
+ /**
+ * Adds a insert element command message to the XML response.
+ *
+ * Usage: $objResponse->addInsert("childDiv", "h3", "myid");
+ *
+ * @param string contains the id of the child before which the new element
+ * will be inserted
+ * @param string the tag to be added
+ * @param string the id to be assigned to the new element
+ */
+ public function addInsert($sBefore, $sTag, $sId)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "ie", "t" => $sBefore, "p" => $sId), $sTag);
+ }
+
+ /**
+ * Adds a insert element command message to the XML response.
+ *
+ * Usage: $objResponse->addInsertAfter("childDiv", "h3", "myid");
+ *
+ * @param string contains the id of the child after which the new element
+ * will be inserted
+ * @param string the tag to be added
+ * @param string the id to be assigned to the new element
+ */
+ public function addInsertAfter($sAfter, $sTag, $sId)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "ia", "t" => $sAfter, "p" => $sId), $sTag);
+ }
+
+ /**
+ * Adds a create input command message to the XML response.
+ *
+ * Usage: $objResponse->addCreateInput("form1", "text", "username", "input1");
+ *
+ * @param string contains the id of an HTML element to which the new input
+ * will be appended
+ * @param string the type of input to be created (text, radio, checkbox,
+ * etc.)
+ * @param string the name to be assigned to the new input and the variable
+ * name when it is submitted
+ * @param string the id to be assigned to the new input
+ */
+ public function addCreateInput($sParent, $sType, $sName, $sId)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "ci", "t" => $sParent, "p" => $sId, "c" => $sType), $sName);
+ }
+
+ /**
+ * Adds an insert input command message to the XML response.
+ *
+ * Usage: $objResponse->addInsertInput("input5", "text", "username", "input1");
+ *
+ * @param string contains the id of the child before which the new element
+ * will be inserted
+ * @param string the type of input to be created (text, radio, checkbox,
+ * etc.)
+ * @param string the name to be assigned to the new input and the variable
+ * name when it is submitted
+ * @param string the id to be assigned to the new input
+ */
+ public function addInsertInput($sBefore, $sType, $sName, $sId)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "ii", "t" => $sBefore, "p" => $sId, "c" => $sType), $sName);
+ }
+
+ /**
+ * Adds an insert input command message to the XML response.
+ *
+ * Usage: $objResponse->addInsertInputAfter("input7", "text", "email", "input2");
+ *
+ * @param string contains the id of the child after which the new element
+ * will be inserted
+ * @param string the type of input to be created (text, radio, checkbox,
+ * etc.)
+ * @param string the name to be assigned to the new input and the variable
+ * name when it is submitted
+ * @param string the id to be assigned to the new input
+ */
+ public function addInsertInputAfter($sAfter, $sType, $sName, $sId)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "iia", "t" => $sAfter, "p" => $sId, "c" => $sType), $sName);
+ }
+
+ /**
+ * Adds an event command message to the XML response.
+ *
+ * Usage: $objResponse->addEvent("contentDiv", "onclick", "alert(\'Hello World\');");
+ *
+ * @param string contains the id of an HTML element
+ * @param string the event you wish to set ("onclick", "onmouseover", etc.)
+ * @param string the Javascript string you want the event to invoke
+ */
+ public function addEvent($sTarget, $sEvent, $sScript)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "ev", "t" => $sTarget, "p" => $sEvent), $sScript);
+ }
+
+ /**
+ * Adds a handler command message to the XML response.
+ *
+ * Usage: $objResponse->addHandler("contentDiv", "onclick", "content_click");
+ *
+ * @param string contains the id of an HTML element
+ * @param string the event you wish to set ("onclick", "onmouseover", etc.)
+ * @param string the name of a Javascript function that will handle the
+ * event. Multiple handlers can be added for the same event
+ */
+ public function addHandler($sTarget, $sEvent, $sHandler)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "ah", "t" => $sTarget, "p" => $sEvent), $sHandler);
+ }
+
+ /**
+ * Adds a remove handler command message to the XML response.
+ *
+ * Usage: $objResponse->addRemoveHandler("contentDiv", "onclick", "content_click");
+ *
+ * @param string contains the id of an HTML element
+ * @param string the event you wish to remove ("onclick", "onmouseover",
+ * etc.)
+ * @param string the name of a Javascript handler function that you want to
+ * remove
+ */
+ public function addRemoveHandler($sTarget, $sEvent, $sHandler)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "rh", "t" => $sTarget, "p" => $sEvent), $sHandler);
+ }
+
+ /**
+ * Adds an include script command message to the XML response.
+ *
+ * Usage: $objResponse->addIncludeScript("functions.js");
+ *
+ * @param string URL of the Javascript file to include
+ */
+ public function addIncludeScript($sFileName)
+ {
+ $this->xml .= $this->_cmdXML(array("n" => "in"), $sFileName);
+ }
+
+ /**
+ * Returns the XML to be returned from your function to the xajax processor
+ * on your page. Since xajax 0.2, you can also return an xajaxResponse
+ * object from your function directly, and xajax will automatically request
+ * the XML using this method call.
+ *
+ * Usage: return $objResponse->getXML();
+ *
+ * @return string response XML data
+ */
+ public function getXML()
+ {
+ $sXML = "sEncoding && strlen(trim($this->sEncoding)) > 0) {
+ $sXML .= " encoding=\"".$this->sEncoding."\"";
+ }
+ $sXML .= " ?".">".$this->xml."";
+
+ return $sXML;
+ }
+
+ /**
+ * Adds the commands of the provided response XML output to this response
+ * object
+ *
+ * Usage:
+ * $r1 = $objResponse1->getXML();
+ * $objResponse2->loadXML($r1);
+ * return $objResponse2->getXML();
+ *
+ * @param string the response XML (returned from a getXML() method) to add
+ * to the end of this response object
+ */
+ public function loadXML($mXML)
+ {
+ if (is_a($mXML, "xajaxResponse")) {
+ $mXML = $mXML->getXML();
+ }
+ $sNewXML = "";
+ $iStartPos = strpos($mXML, "") + 5;
+ $sNewXML = substr($mXML, $iStartPos);
+ $iEndPos = strpos($sNewXML, "");
+ $sNewXML = substr($sNewXML, 0, $iEndPos);
+ $this->xml .= $sNewXML;
+ }
+
+ /**
+ * Generates XML from command data
+ *
+ * @access private
+ * @param array associative array of attributes
+ * @param string data
+ * @return string XML command
+ */
+ public function _cmdXML($aAttributes, $sData)
+ {
+ if ($this->bOutputEntities) {
+ // An adaptation for the Dokeos LMS, 22-AUG-2009.
+ if (function_exists('api_convert_encoding')) {
+ $sData = call_user_func_array(
+ 'api_convert_encoding',
+ array(&$sData, 'HTML-ENTITIES', $this->sEncoding)
+ );
+ } //if (function_exists('mb_convert_encoding')) {
+ elseif (function_exists('mb_convert_encoding')) {
+ //
+ $sData = call_user_func_array('mb_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
+ } else {
+ trigger_error(
+ "The xajax XML response output could not be converted to HTML entities because the mb_convert_encoding function is not available",
+ E_USER_NOTICE
+ );
+ }
+ }
+ $xml = " $sValue) {
+ $xml .= " $sAttribute=\"$sValue\"";
+ }
+ if ($sData !== null && !stristr($sData, '";
+ } else {
+ if ($sData !== null) {
+ $xml .= ">$sData";
+ } else {
+ $xml .= ">";
+ }
+ }
+
+ return $xml;
+ }
+
+ /**
+ * Recursively serializes a data structure in XML so it can be sent to
+ * the client. It could be thought of as the opposite of
+ * {@link xajax::_parseObjXml()}.
+ *
+ * @access private
+ * @param mixed data structure to serialize to XML
+ * @return string serialized XML
+ */
+ public function _buildObjXml($var)
+ {
+ if (gettype($var) == "object") {
+ $var = get_object_vars($var);
+ }
+ if (!is_array($var)) {
+ return "";
+ } else {
+ $data = "";
+ foreach ($var as $key => $value) {
+ $data .= "";
+ $data .= "".htmlspecialchars($key)."";
+ $data .= "".$this->_buildObjXml($value)."";
+ $data .= "";
+ }
+ $data .= "";
+ return $data;
+ }
+ }
+}
diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyLearnpath.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyLearnpath.php
index 9a9b1de43a..b1d7e4d4eb 100644
--- a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyLearnpath.php
+++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyLearnpath.php
@@ -171,7 +171,7 @@ class CourseCopyLearnpath extends Resource
/**
* Get the items
*/
- function get_items()
+ public function get_items()
{
return $this->items;
}
@@ -179,7 +179,7 @@ class CourseCopyLearnpath extends Resource
/**
* Check if a given resource is used as an item in this chapter
*/
- function has_item($resource)
+ public function has_item($resource)
{
foreach ($this->items as $item) {
if ($item['id'] == $resource->get_id() &&
@@ -194,7 +194,7 @@ class CourseCopyLearnpath extends Resource
/**
* Show this learnpath
*/
- function show()
+ public function show()
{
parent::show();
echo $this->name;
diff --git a/src/Chamilo/ThemeBundle/Model/MenuItemModel.php b/src/Chamilo/ThemeBundle/Model/MenuItemModel.php
index 28034d93da..58e2e7c5cc 100644
--- a/src/Chamilo/ThemeBundle/Model/MenuItemModel.php
+++ b/src/Chamilo/ThemeBundle/Model/MenuItemModel.php
@@ -59,7 +59,7 @@ class MenuItemModel implements MenuItemInterface
*/
protected $parent = null;
- function __construct(
+ public function __construct(
$id,
$label,
$route,
@@ -294,7 +294,7 @@ class MenuItemModel implements MenuItemInterface
public function removeChild(MenuItemInterface $child)
{
if (false !== ($key = array_search($child, $this->children))) {
- unset ($this->children[$key]);
+ unset($this->children[$key]);
}
return $this;