diff --git a/main/exercise/exercise_submit_modal.php b/main/exercise/exercise_submit_modal.php index 20b641912e..d91ecf2442 100755 --- a/main/exercise/exercise_submit_modal.php +++ b/main/exercise/exercise_submit_modal.php @@ -4,9 +4,9 @@ use ChamiloSession as Session; /** -* @package chamilo.exercise -* @author Julio Montoya -*/ + * @package chamilo.exercise + * @author Julio Montoya + */ require_once __DIR__.'/../inc/global.inc.php'; api_protect_course_script(false); @@ -79,40 +79,40 @@ if (isset($_GET['choice'])) { // Getting the options by js if (empty($choice_value)) { echo "'; + echo ''; exit; } @@ -152,9 +152,9 @@ Session::write('exerciseResultCoordinates', $exerciseResultCoordinates); if($questionNum >= $nbrQuestions) { if($debug>0){echo str_repeat(' ',0).'Redirecting to exercise_result.php - Remove debug option to let this happen'."
\n";} - // goes to the script that will show the result of the exercise + // goes to the script that will show the result of the exercise // header("Location: exercise_result.php?origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id"); - // echo 'location result'; + // echo 'location result'; }*/ // creates a temporary Question object @@ -431,29 +431,29 @@ if (!empty($choice_value)) { $final_excess = 100; } - $table_resume = ' - - - - - - - - - - - - - - - - - - - - - -
'.get_lang('Requirements').''.get_lang('YourAnswer').'
'.get_lang('Overlap').''.get_lang('Min').' '.$threadhold1.'
'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'
'.get_lang('Excess').''.get_lang('Max').' '.$threadhold2.'
'.(($final_excess < 0) ? 0 : intval($final_excess)).'
'.get_lang('Missing').''.get_lang('Max').' '.$threadhold3.'
'.(($final_missing < 0) ? 0 : intval($final_missing)).'
'; + $table_resume = ' + + + + + + + + + + + + + + + + + + + + + +
'.get_lang('Requirements').''.get_lang('YourAnswer').'
'.get_lang('Overlap').''.get_lang('Min').' '.$threadhold1.'
'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'
'.get_lang('Excess').''.get_lang('Max').' '.$threadhold2.'
'.(($final_excess < 0) ? 0 : intval($final_excess)).'
'.get_lang('Missing').''.get_lang('Max').' '.$threadhold3.'
'.(($final_missing < 0) ? 0 : intval($final_missing)).'
'; } Session::write('newquestionList', $newquestionList); $links = ''; @@ -510,45 +510,45 @@ if (isset($try) && $try == 1) { // the link to theory (a learning path) if (!empty($lp)) { - $lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; - $list = new LearnpathList(api_get_user_id()); - $flat_list = $list->get_flat_list(); + $lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; + $list = new LearnpathList(api_get_user_id()); + $flat_list = $list->get_flat_list(); $links .= Display:: return_icon( - 'theory.gif', - '', - array('style' => 'padding-left:0px;padding-right:5px;') - ).''.get_lang('SeeTheory').'
'; + 'theory.gif', + '', + array('style' => 'padding-left:0px;padding-right:5px;') + ).''.get_lang('SeeTheory').'
'; } $links .= '
'; // the link to an external website or link if (!empty($url)) { $links .= Display:: return_icon( - 'link.gif', - '', - array('style' => 'padding-left:0px;padding-right:5px;') + 'link.gif', + '', + array('style' => 'padding-left:0px;padding-right:5px;') ).''.get_lang('VisitUrl').'

'; } // the link to finish the test if ($destinationid == -1) { $links .= Display:: return_icon( - 'finish.gif', - '', - array('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;') - ).''.get_lang('EndActivity').'

'; + 'finish.gif', + '', + array('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;') + ).''.get_lang('EndActivity').'

'; } else { - // the link to other question - if (in_array($destinationid, $questionList)) { - $objQuestionTmp = Question :: read($destinationid); - $questionName = $objQuestionTmp->selectTitle(); - $num_value_array = (array_keys($questionList, $destinationid)); + // the link to other question + if (in_array($destinationid, $questionList)) { + $objQuestionTmp = Question :: read($destinationid); + $questionName = $objQuestionTmp->selectTitle(); + $num_value_array = (array_keys($questionList, $destinationid)); $links .= Display:: return_icon( 'quiz.png', '', array('style' => 'padding-left:0px;padding-right:5px;') ).''.get_lang('GoToQuestion').' '.$num_value_array[0].'

'; - } + } } echo ''; if ($links != '') { - echo '

'.get_lang('Feedback').'

'; - if ($answerType == HOT_SPOT_DELINEATION) { - if ($organs_at_risk_hit > 0) { - //$message='

'.get_lang('YourDelineation').'

'; - //$message.=$table_resume; - $message .= '
'.get_lang('ResultIs').' '.get_lang('Unacceptable').'
'; - //if ($wrong_results) { } - $message .= '

'.get_lang('OARHit').'

'; - $message .= '

'.$comment.'

'; - } else { - $message = '

'.get_lang('YourDelineation').'

'; - $message .= $table_resume; - $message .= '
'.get_lang('ResultIs').' '.$result_comment.'
'; - $message .= '

'.$comment.'

'; - } - echo $message; - } else { - echo '

'.$comment.'

'; - } - echo '

'.$links.'

'; - echo ''; - - Session::write('hot_spot_result', $message); - $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]); + echo '

'.get_lang('Feedback').'

'; + if ($answerType == HOT_SPOT_DELINEATION) { + if ($organs_at_risk_hit > 0) { + //$message='

'.get_lang('YourDelineation').'

'; + //$message.=$table_resume; + $message .= '
'.get_lang('ResultIs').' '.get_lang('Unacceptable').'
'; + //if ($wrong_results) { } + $message .= '

'.get_lang('OARHit').'

'; + $message .= '

'.$comment.'

'; + } else { + $message = '

'.get_lang('YourDelineation').'

'; + $message .= $table_resume; + $message .= '
'.get_lang('ResultIs').' '.$result_comment.'
'; + $message .= '

'.$comment.'

'; + } + echo $message; + } else { + echo '

'.$comment.'

'; + } + echo '

'.$links.'

'; + echo ''; + + Session::write('hot_spot_result', $message); + $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]); //reseting the exerciseResult variable Session::write('exerciseResult', $exerciseResult); @@ -597,11 +597,11 @@ if ($links != '') { $_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult']; $_SESSION['questionListExtra'.$exerciseId] = $_SESSION['questionList']; } else { - $questionNum++; - echo ''; + $questionNum++; + echo ''; } echo ''; diff --git a/main/gradebook/lib/be/evaluation.class.php b/main/gradebook/lib/be/evaluation.class.php index e7c68a5716..64f961c857 100755 --- a/main/gradebook/lib/be/evaluation.class.php +++ b/main/gradebook/lib/be/evaluation.class.php @@ -225,7 +225,7 @@ class Evaluation implements GradebookItem $sql = 'SELECT * FROM '.$tbl_grade_evaluations; $paramcount = 0; - if (isset ($id)) { + if (isset($id)) { $sql .= ' WHERE id = '.intval($id); $paramcount++; } @@ -670,7 +670,11 @@ class Evaluation implements GradebookItem $subcats = Category::load(null, null, null, $catid); foreach ($subcats as $cat) { $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1); - $targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id()); + $targets = $this->add_target_subcategories( + $targets, + $level + 1, + $cat->get_id() + ); } return $targets; } @@ -694,6 +698,7 @@ class Evaluation implements GradebookItem * and return them as an array of Evaluation objects * @param int $cat_id parent category (use 'null' to retrieve them in all categories) * @param int $stud_id student id + * @return array */ public static function get_evaluations_with_result_for_student($cat_id = null, $stud_id) { @@ -722,6 +727,8 @@ class Evaluation implements GradebookItem /** * Get a list of students that do not have a result record for this evaluation + * @param string $first_letter_user + * @return array */ public function get_not_subscribed_students($first_letter_user = '') { @@ -777,14 +784,14 @@ class Evaluation implements GradebookItem * @param int locked 1 or unlocked 0 * **/ - function lock($locked) + public function lock($locked) { $table_evaluation = Database::get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION); $sql = "UPDATE $table_evaluation SET locked = '".intval($locked)."' WHERE id='".intval($this->id)."'"; Database::query($sql); } - function check_lock_permissions() + public function check_lock_permissions() { if (api_is_platform_admin()) { return true; @@ -795,7 +802,7 @@ class Evaluation implements GradebookItem } } - function delete_linked_data() + public function delete_linked_data() { } diff --git a/main/lp/openoffice_text_document.class.php b/main/lp/openoffice_text_document.class.php index b45a815a0d..397a7f4b28 100755 --- a/main/lp/openoffice_text_document.class.php +++ b/main/lp/openoffice_text_document.class.php @@ -1,5 +1,6 @@ split_steps = $split_steps; + public function __construct( + $split_steps = false, + $course_code = null, + $resource_id = null, + $user_id = null + ) { + $this->split_steps = $split_steps; parent::__construct($course_code, $resource_id, $user_id); } @@ -44,7 +51,9 @@ class OpenOfficeTextDocument extends OpenofficeDocument { { $_course = api_get_course_info(); // We get a content where ||page_break|| indicates where the page is broken. - if (!file_exists($this->base_work_dir.'/'.$this->created_dir.'/'.$this->file_name.'.html')) { return false; } + if (!file_exists($this->base_work_dir.'/'.$this->created_dir.'/'.$this->file_name.'.html')) { + return false; + } $content = file_get_contents($this->base_work_dir.'/'.$this->created_dir.'/'.$this->file_name.'.html'); unlink($this->base_work_dir.'/'.$this->file_path); @@ -71,7 +80,9 @@ class OpenOfficeTextDocument extends OpenofficeDocument { // Chamilo styles. $my_style = api_get_setting('stylesheets'); - if (empty($my_style)) { $my_style = 'chamilo'; } + if (empty($my_style)) { + $my_style = 'chamilo'; + } $style_to_import = "\r\n"; @@ -98,10 +109,9 @@ class OpenOfficeTextDocument extends OpenofficeDocument { * @param string Content * @return void */ - function dealPerChapter($header, $content) + public function dealPerChapter($header, $content) { $_course = api_get_course_info(); - $content = str_replace('||page_break||', '', $content); // Get all the h1. @@ -122,9 +132,9 @@ class OpenOfficeTextDocument extends OpenofficeDocument { $items_to_create[get_lang('Introduction')] = $intro_content; for ($i = 0; $i < count($matches[0]); $i++) { - - if (empty($matches[1][$i])) + if (empty($matches[1][$i])) { continue; + } $content = api_strstr($content, $matches[0][$i]); if ($i + 1 !== count($matches[0])) { @@ -155,7 +165,6 @@ class OpenOfficeTextDocument extends OpenofficeDocument { ); if ($document_id) { - // Put the document in item_property update. api_item_property_update( $_course, @@ -188,20 +197,20 @@ class OpenOfficeTextDocument extends OpenofficeDocument { * @param string Page body * @return void */ - function dealPerPage($header, $body) + public function dealPerPage($header, $body) { $_course = api_get_course_info(); // Split document to pages. $pages = explode('||page_break||', $body); - $first_item = 0; - foreach ($pages as $key => $page_content) { // For every pages, we create a new file. - $key += 1; - - $page_content = $this->format_page_content($header, $page_content, $this->base_work_dir.$this->created_dir); + $page_content = $this->format_page_content( + $header, + $page_content, + $this->base_work_dir.$this->created_dir + ); $html_file = $this->created_dir.'-'.$key.'.html'; $handle = fopen($this->base_work_dir.$this->created_dir.'/'.$html_file, 'w+'); fwrite($handle, $page_content); @@ -243,7 +252,7 @@ class OpenOfficeTextDocument extends OpenofficeDocument { //echo Display::return_message(print_r($_POST)); $di = new ChamiloIndexer(); isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; - $di->connectDb(NULL, NULL, $lang); + $di->connectDb(null, null, $lang); $ic_slide = new IndexableChunk(); $ic_slide->addValue('title', $slide_name); $specific_fields = get_specific_field_list(); @@ -294,7 +303,8 @@ class OpenOfficeTextDocument extends OpenofficeDocument { * Returns additional Java command parameters * @return string The additional parameters to be used in the Java call */ - function add_command_parameters() { + public function add_command_parameters() + { return ' -d woogie "'.$this->base_work_dir.'/'.$this->file_path.'" "'.$this->base_work_dir.$this->created_dir.'/'.$this->file_name.'.html"'; } @@ -304,8 +314,8 @@ class OpenOfficeTextDocument extends OpenofficeDocument { * @param string Page content * @return string Formatted page content */ - function format_page_content($header, $content) { - + public function format_page_content($header, $content) + { // Limit the width of the doc. list($max_width, $max_height) = explode('x', api_get_setting('service_ppt2lp', 'size')); @@ -330,7 +340,6 @@ class OpenOfficeTextDocument extends OpenofficeDocument { $defined_width = preg_match("|width=([^\s]*)|i", $images[0][$key], $img_width); $img_width = $img_width[1]; if (!$defined_width) { - $image_size = api_getimagesize($this->base_work_dir.$this->created_dir.'/'.$image); $img_width = $image_size['width']; $img_height = $image_size['height']; @@ -340,7 +349,6 @@ class OpenOfficeTextDocument extends OpenofficeDocument { $picture_resized = str_ireplace(' $max_width - 10) { $picture_resized = str_ireplace('width='.$img_width, 'width="'.($max_width - 10).'"', $images[0][$key]); $content = str_replace($images[0][$key], $picture_resized, $content); @@ -353,7 +361,8 @@ class OpenOfficeTextDocument extends OpenofficeDocument { /** * Add documents to the visioconference (to be implemented) */ - function add_docs_to_visio() { + public function add_docs_to_visio() + { } }