// $information_title = get_lang('InfoAboutLastDoneAdvanceAndNextAdvanceNotDone');
             $last_done_advance = $thematic->get_last_done_thematic_advance();
             $next_advance_not_done = $thematic->get_next_thematic_advance_not_done();
             $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance);
             $thematic_advance_info2 = $thematic->get_thematic_advance_list($next_advance_not_done);
             $subTitle1 = get_lang('CurrentTopic');
             $subTitle2 = get_lang('NextTopic');
             $class1 = ' current';
         }
     }
 }
 if (!empty($thematic_advance_info)) {
     $thematic_advance = get_lang('CourseThematicAdvance');
     $thematicScore = $thematic->get_total_average_of_thematic_advances() . '%';
     $thematicUrl = api_get_path(WEB_CODE_PATH) . 'course_progress/index.php?action=thematic_details&' . api_get_cidreq();
     $thematic_info = $thematic->get_thematic_list($thematic_advance_info['thematic_id']);
     $thematic_advance_info['start_date'] = api_get_local_time($thematic_advance_info['start_date']);
     $thematic_advance_info['start_date'] = api_format_date($thematic_advance_info['start_date'], DATE_TIME_FORMAT_LONG);
     $userInfo = api_get_user_info();
     $courseInfo = api_get_course_info();
     $titleThematic = $thematic_advance . ' : ' . $courseInfo['name'] . ' <b>( ' . $thematicScore . ' )</b>';
     $infoUser = '******' . $userInfo['avatar'] . '" class="img-circle img-responsive"></div>';
     $infoUser .= '<div class="progress">
                     <div class="progress-bar progress-bar-danger" role="progressbar" style="width: ' . $thematicScore . ';">
                     ' . $thematicScore . '
                     </div>
                 </div>';
     $thematicItemOne = '
     <div class="col-md-6 items-progress">
         <div class="thematic-cont ' . $class1 . '">
         <div class="topics">' . $subTitle1 . '</div>
Esempio n. 2
0
// get thematic id
if (isset($_GET['thematic_id'])) {
    $thematic_id = intval($_GET['thematic_id']);
}
// get thematic plan description type
if (isset($_GET['description_type'])) {
    $description_type = intval($_GET['description_type']);
}
$courseInfo = api_get_course_info();
// instance thematic object for using like library here
$thematic = new Thematic($courseInfo);
// thematic controller object
$thematic_controller = new ThematicController();
if (!empty($thematic_id)) {
    // thematic data by id
    $thematic_data = $thematic->get_thematic_list($thematic_id);
}
// get default thematic plan title
$default_thematic_plan_title = $thematic->get_default_thematic_plan_title();
// Only when I see the 3 columns. Avoids double or triple click binding for onclick event
$htmlHeadXtra[] = '<script type="text/javascript">

$(document).ready(function() {

	//Second col
     /*
    $("#thematic_plan_add").live("submit", function() {

		var serialize_form_content = $(this).serialize();

		//Getting FCK content
Esempio n. 3
0
     				}
     			}
     		}
     		$thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true);
     		$return = $thematic->get_thematic_advance_div($thematic_advance_data);
     		echo $return[$_REQUEST['thematic_id']][$_REQUEST['thematic_advance_id']];*/
     break;
 case 'get_datetime_by_attendance':
     $attendance_id = intval($_REQUEST['attendance_id']);
     $thematic_advance_id = intval($_REQUEST['thematic_advance_id']);
     $label = '';
     $input_select = '';
     if (!empty($attendance_id)) {
         $attendance = new Attendance();
         $thematic = new Thematic();
         $thematic_list = $thematic->get_thematic_list();
         $my_list = $thematic_list_temp = array();
         foreach ($thematic_list as $item) {
             $my_list = $thematic->get_thematic_advance_by_thematic_id($item['id']);
             $thematic_list_temp = array_merge($my_list, $thematic_list_temp);
         }
         $new_thematic_list = array();
         foreach ($thematic_list_temp as $item) {
             if (!empty($item['attendance_id'])) {
                 $new_thematic_list[$item['id']] = array('attendance_id' => $item['attendance_id'], 'start_date' => $item['start_date']);
             }
         }
         $attendance_calendar = $attendance->get_attendance_calendar($attendance_id);
         $label = get_lang('StartDate');
         if (!empty($attendance_calendar)) {
             $input_select .= '<select id="start_date_select_calendar" name="start_date_by_attendance" UNIQUE size="5">';
Esempio n. 4
0
 /**
  * This method is used for thematic plan control (update, insert or listing)
  * @param 	string	$action
  * render to thematic_plan.php
  */
 public function thematic_plan($action)
 {
     $thematic = new Thematic();
     $data = array();
     if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
         if (isset($_POST['action']) && ($_POST['action'] == 'thematic_plan_add' || $_POST['action'] == 'thematic_plan_edit')) {
             if (isset($_POST['title'])) {
                 if ($_POST['thematic_plan_token'] == $_SESSION['thematic_plan_token']) {
                     if (api_is_allowed_to_edit(null, true)) {
                         $title_list = $_REQUEST['title'];
                         $description_list = $_REQUEST['description'];
                         $description_type = $_REQUEST['description_type'];
                         for ($i = 1; $i < count($title_list) + 1; $i++) {
                             $thematic->set_thematic_plan_attributes($_REQUEST['thematic_id'], $title_list[$i], $description_list[$i], $description_type[$i]);
                             $thematic->thematic_plan_save();
                         }
                         unset($_SESSION['thematic_plan_token']);
                         $data['message'] = 'ok';
                         $saveRedirect = api_get_path(WEB_PATH) . 'main/course_progress/index.php?';
                         $saveRedirect .= api_get_cidreq() . '&';
                         $saveRedirect .= 'thematic_plan_save_message=ok';
                         header("Location: {$saveRedirect}");
                         exit;
                     }
                     $data['action'] = 'thematic_plan_list';
                 }
             } else {
                 $error = true;
                 $action = $_POST['action'];
                 $data['error'] = $error;
                 $data['thematic_plan_data'] = $thematic->get_thematic_plan_data($_POST['thematic_id'], $_POST['description_type']);
                 $data['thematic_id'] = $_POST['thematic_id'];
                 $data['description_type'] = $_POST['description_type'];
                 $data['action'] = $action;
                 $data['default_thematic_plan_title'] = $thematic->get_default_thematic_plan_title();
                 $data['default_thematic_plan_icon'] = $thematic->get_default_thematic_plan_icon();
                 $data['default_thematic_plan_question'] = $thematic->get_default_question();
                 $data['next_description_type'] = $thematic->get_next_description_type($_POST['thematic_id']);
                 // render to the view
                 $this->view->set_data($data);
                 $this->view->set_layout('layout');
                 $this->view->set_template('thematic_plan');
                 $this->view->render();
             }
         }
     }
     $thematic_id = intval($_GET['thematic_id']);
     if ($action == 'thematic_plan_list') {
         $data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
     }
     $description_type = isset($_GET['description_type']) ? intval($_GET['description_type']) : null;
     if (!empty($thematic_id) && !empty($description_type)) {
         if ($action == 'thematic_plan_delete') {
             if (api_is_allowed_to_edit(null, true)) {
                 $thematic->thematic_plan_destroy($thematic_id, $description_type);
             }
             $data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
             $action = 'thematic_plan_list';
         } else {
             $data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id, $description_type);
         }
         $data['thematic_id'] = $thematic_id;
         $data['description_type'] = $description_type;
     } else {
         if (!empty($thematic_id) && $action == 'thematic_plan_list') {
             $data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
             $data['thematic_id'] = $thematic_id;
         }
     }
     $data['thematic_id'] = $thematic_id;
     $data['action'] = $action;
     $data['default_thematic_plan_title'] = $thematic->get_default_thematic_plan_title();
     $data['default_thematic_plan_icon'] = $thematic->get_default_thematic_plan_icon();
     $data['next_description_type'] = $thematic->get_next_description_type($thematic_id);
     $data['default_thematic_plan_question'] = $thematic->get_default_question();
     $data['thematic_data'] = $thematic->get_thematic_list($thematic_id);
     //render to the view
     $this->view->set_data($data);
     $this->view->set_layout('layout');
     $this->view->set_template('thematic_plan');
     $this->view->render();
     exit;
 }
 /**
  * This method is used for thematic plan control (update, insert or listing)
  * @param 	string	Action
  * render to thematic_plan.php
  */
 public function thematic_plan($action)
 {
     $courseInfo = api_get_course_info();
     $thematic = new Thematic($courseInfo);
     $data = array();
     $error = false;
     if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
         if (isset($_POST['action']) && ($_POST['action'] == 'thematic_plan_add' || $_POST['action'] == 'thematic_plan_edit')) {
             if (isset($_POST['title'])) {
                 if ($_POST['thematic_plan_token'] == $_SESSION['thematic_plan_token']) {
                     if (api_is_allowed_to_edit(null, true)) {
                         $title_list = $_REQUEST['title'];
                         $description_list = $_REQUEST['description'];
                         $description_type = $_REQUEST['description_type'];
                         $delete_list = $_REQUEST['delete'];
                         foreach ($title_list as $id => $title) {
                             $thematic_plan_id = $id;
                             if (!$thematic->get_thematic_data_by_id($id)) {
                                 $thematic_plan_id = null;
                             }
                             $thematic->set_thematic_plan_attributes($_REQUEST['thematic_id'], $title, $description_list[$id], $description_type[$id], $thematic_plan_id);
                             if (isset($delete_list[$id]) && !empty($delete_list[$id])) {
                                 $thematic->thematic_plan_delete();
                             } else {
                                 $affected_rows = $thematic->thematic_plan_save();
                             }
                         }
                         unset($_SESSION['thematic_plan_token']);
                         $data['message'] = 'ok';
                     }
                     $data['action'] = 'thematic_plan_list';
                 }
             } else {
                 $error = true;
                 $action = $_POST['action'];
                 $data['error'] = $error;
                 $data['thematic_plan_data'] = $thematic->get_thematic_plan_data($_POST['thematic_id'], $_POST['description_type']);
                 $data['thematic_id'] = $_POST['thematic_id'];
                 $data['description_type'] = $_POST['description_type'];
                 $data['action'] = $action;
                 $data['default_thematic_plan_title'] = $thematic->get_default_thematic_plan_title();
                 $data['default_thematic_plan_icon'] = $thematic->get_default_thematic_plan_icon();
                 $data['default_thematic_plan_question'] = $thematic->get_default_question();
                 $data['next_description_type'] = $thematic->get_next_description_type($_POST['thematic_id']);
                 // render to the view
                 $this->view->set_data($data);
                 $this->view->set_layout('layout');
                 $this->view->set_template('thematic_plan');
                 $this->view->render();
             }
         }
     }
     $thematic_id = intval($_GET['thematic_id']);
     if ($action == 'thematic_plan_list') {
         $data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
     }
     $description_type = intval($_GET['description_type']);
     if (!empty($thematic_id) && !empty($description_type)) {
         if ($action == 'thematic_plan_delete') {
             if (api_is_allowed_to_edit(null, true)) {
                 $affected_rows = $thematic->thematic_plan_destroy($thematic_id, $description_type);
             }
             $data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
             $action = 'thematic_plan_list';
         } else {
             $data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id, $description_type);
         }
         $data['thematic_id'] = $thematic_id;
         $data['description_type'] = $description_type;
     } else {
         if (!empty($thematic_id) && $action == 'thematic_plan_list') {
             $data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
             $data['thematic_id'] = $thematic_id;
         }
     }
     $data['thematic_id'] = $thematic_id;
     $data['action'] = $action;
     $data['default_thematic_plan_title'] = $thematic->get_default_thematic_plan_title();
     $data['default_thematic_plan_icon'] = $thematic->get_default_thematic_plan_icon();
     $data['next_description_type'] = $thematic->get_next_description_type($thematic_id);
     $data['default_thematic_plan_question'] = $thematic->get_default_question();
     $data['thematic_data'] = $thematic->get_thematic_list($thematic_id);
     //render to the view
     $this->view->set_data($data);
     $this->view->set_layout('layout');
     $this->view->set_template('thematic_plan');
     $this->view->render();
     exit;
 }
Esempio n. 6
0
 /**
  * @param string $tool
  * @param array $toolList
  *
  * @return null
  */
 public static function return_introduction_section($tool, $toolList = array())
 {
     $urlGenerator = Container::getRouter();
     $is_allowed_to_edit = api_is_allowed_to_edit();
     $courseInfo = api_get_course_info();
     $introduction_section = null;
     if (api_get_setting('course.enable_tool_introduction') == 'true' || $tool == TOOL_COURSE_HOMEPAGE) {
         $introduction_section = null;
         $TBL_INTRODUCTION = Database::get_course_table(TABLE_TOOL_INTRO);
         $session_id = api_get_session_id();
         $course_id = api_get_course_int_id();
         /* Retrieves the module introduction text, if exist */
         $sql = "SELECT iid, intro_text FROM {$TBL_INTRODUCTION}\n                    WHERE\n                        c_id = {$course_id} AND\n                        tool ='" . Database::escape_string($tool) . "' AND\n                        session_id = '" . intval($session_id) . "'";
         $intro_dbQuery = Database::query($sql);
         $introContent = null;
         $toolId = null;
         if (Database::num_rows($intro_dbQuery) > 0) {
             $row = Database::fetch_array($intro_dbQuery);
             $introContent = $row['intro_text'];
             $toolId = $row['iid'];
         }
         $introContent = CourseHome::replaceTextWithToolUrls($introContent, $toolList);
         /* Determines the correct display */
         $displayIntro = false;
         if ($is_allowed_to_edit) {
             $displayIntro = true;
         }
         $thematicDescription = '';
         if ($tool == TOOL_COURSE_HOMEPAGE) {
             $thematic = new Thematic($courseInfo);
             $thematic->set_course_int_id(api_get_course_int_id());
             if (api_get_course_setting('display_info_advance_inside_homecourse') == '1') {
                 $information_title = get_lang('InfoAboutLastDoneAdvance');
                 $last_done_advance = $thematic->get_last_done_thematic_advance();
                 $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance);
             } else {
                 if (api_get_course_setting('display_info_advance_inside_homecourse') == '2') {
                     $information_title = get_lang('InfoAboutNextAdvanceNotDone');
                     $next_advance_not_done = $thematic->get_next_thematic_advance_not_done();
                     $thematic_advance_info = $thematic->get_thematic_advance_list($next_advance_not_done);
                 } else {
                     if (api_get_course_setting('display_info_advance_inside_homecourse') == '3') {
                         $information_title = get_lang('InfoAboutLastDoneAdvanceAndNextAdvanceNotDone');
                         $last_done_advance = $thematic->get_last_done_thematic_advance();
                         $next_advance_not_done = $thematic->get_next_thematic_advance_not_done();
                         $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance);
                         $thematic_advance_info2 = $thematic->get_thematic_advance_list($next_advance_not_done);
                     }
                 }
             }
             if (!empty($thematic_advance_info)) {
                 $thematic_advance = get_lang('CourseThematicAdvance') . '&nbsp;' . $thematic->get_total_average_of_thematic_advances() . '%';
                 $thematic_info = $thematic->get_thematic_list($thematic_advance_info['thematic_id']);
                 $thematic_advance_info['start_date'] = api_get_local_time($thematic_advance_info['start_date']);
                 $thematic_advance_info['start_date'] = api_format_date($thematic_advance_info['start_date'], DATE_TIME_FORMAT_LONG);
                 $thematicDescription = '<div class="thematic-postit">
                                               <div class="thematic-postit-top"><h3><a class="thematic-postit-head" style="" href="#"> ' . $thematic_advance . '</h3></a></div>
                                               <div class="thematic-postit-center" style="display:none">';
                 $thematicDescription .= '<div><strong>' . $thematic_info['title'] . '</strong></div>';
                 $thematicDescription .= '<div style="font-size:8pt;"><strong>' . $thematic_advance_info['start_date'] . '</strong></div>';
                 $thematicDescription .= '<div>' . $thematic_advance_info['content'] . '</div>';
                 $thematicDescription .= '<div>' . get_lang('DurationInHours') . ' : ' . $thematic_advance_info['duration'] . '</div>';
                 if (!empty($thematic_advance_info2)) {
                     $thematic_info2 = $thematic->get_thematic_list($thematic_advance_info2['thematic_id']);
                     $thematic_advance_info2['start_date'] = api_get_local_time($thematic_advance_info2['start_date']);
                     $thematic_advance_info2['start_date'] = api_format_date($thematic_advance_info2['start_date'], DATE_TIME_FORMAT_LONG);
                     $thematicDescription .= '<div><strong>' . $thematic_info2['title'] . '</strong></div>';
                     $thematicDescription .= '<div style="font-size:8pt;"><strong>' . $thematic_advance_info2['start_date'] . '</strong></div>';
                     $thematicDescription .= '<div>' . $thematic_advance_info2['content'] . '</div>';
                     $thematicDescription .= '<div>' . get_lang('DurationInHours') . ' : ' . $thematic_advance_info2['duration'] . '</div>';
                     $thematicDescription .= '<br />';
                 }
                 $thematicDescription .= '</div>
                                           <div class="thematic-postit-bottom"></div>
                                           </div>';
             }
         }
         $introduction_section .= '<div id="introduction_block" class="row"><div class="col-md-12">';
         $introduction_section .= $thematicDescription;
         if (!empty($introContent)) {
             $introduction_section .= $introContent;
         }
         $introduction_section .= '</div>';
         if ($displayIntro) {
             if (empty($introContent)) {
                 // Displays "Add intro" commands
                 $introduction_section .= '<div id="introduction_block_action" class="col-md-2 col-md-offset-10">';
                 $em = Database::getManager();
                 $criteria = ['tool' => $tool, 'cId' => api_get_course_int_id()];
                 $toolIntro = $em->getRepository('ChamiloCourseBundle:CToolIntro')->findOneBy($criteria);
                 if ($toolIntro) {
                     $url = $urlGenerator->generate('chamilo_course_ctoolintro_update', array('tool' => $toolIntro->getTool(), 'course' => api_get_course_id(), 'iid' => $toolIntro->getId()));
                 } else {
                     $url = $urlGenerator->generate('chamilo_course_ctoolintro_create', array('tool' => $tool, 'course' => api_get_course_id()));
                 }
                 $introduction_section .= "<a href=\"" . $url . "?" . api_get_cidreq() . "\">";
                 $introduction_section .= Display::return_icon('introduction_add.gif', get_lang('AddIntro')) . ' ';
                 $introduction_section .= "</a>";
                 $introduction_section .= "</div>";
             } else {
                 // Displays "edit intro && delete intro" commands
                 $introduction_section .= '<div id="introduction_block_action" class="col-md-2 col-md-offset-10">';
                 $url = $urlGenerator->generate('chamilo_course_ctoolintro_update', array('tool' => $tool, 'iid' => $toolId, 'course' => api_get_course_id()));
                 $introduction_section .= "<a href=\"" . $url . "?" . api_get_cidreq() . "\">";
                 $introduction_section .= Display::return_icon('edit.png', get_lang('Modify')) . ' ';
                 $introduction_section .= "</a>";
                 $url = $urlGenerator->generate('chamilo_course_ctoolintro_delete', array('iid' => $toolId, 'course' => api_get_course_id()));
                 $introduction_section .= "<a onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'))) . "')) return false;\" href=\"" . $url . "?" . api_get_cidreq() . "\">";
                 $introduction_section .= Display::return_icon('delete.png', get_lang('AddIntro')) . ' ';
                 $introduction_section .= "</a>";
                 $introduction_section .= "</div>";
             }
         }
         $introduction_section .= '</div>';
     }
     return $introduction_section;
     /*$moduleId = $tool;
       if (api_get_setting('course.enable_tool_introduction') == 'true' ||
           $tool == TOOL_COURSE_HOMEPAGE
       ) {
           $introduction_section = null;
           require api_get_path(INCLUDE_PATH).'introductionSection.inc.php';
           return $introduction_section;
       }*/
 }