function approveuser(&$url) { checkPerm('view'); require_once $GLOBALS['where_framework'] . '/lib/lib.myfriends.php'; require_once _base_ . '/lib/lib.table.php'; $lang =& DoceboLanguage::createInstance('myfriends', 'lms'); $acl_man =& Docebo::user()->getAclManager(); $my_fr = new MyFriends(getLogUserId()); if (isset($_GET['id_friend'])) { switch ($_GET['action']) { case "2": $my_fr->addFriend($_GET['id_friend'], MF_APPROVED, ''); $my_fr->approveFriend($_GET['id_friend']); break; case "1": $my_fr->approveFriend($_GET['id_friend']); break; case "0": $my_fr->refuseFriend($_GET['id_friend']); break; } } $users_info = $my_fr->getPendentRequest(); require_once _base_ . '/lib/lib.user_profile.php'; $GLOBALS['page']->add(getTitleArea($lang->def('_MY_FRIENDS'), 'myfriends') . '<div class="std_block">', 'content'); if (!is_array($users_info) || empty($users_info)) { Util::jump_to($url->getUrl()); } while (list(, $ui) = each($users_info)) { $profile = new UserProfile($ui['id']); $profile->init('profile', 'framework', 'modname=myfriends&op=approveuser', 'ap'); $GLOBALS['page']->add($profile->minimalUserInfo() . '<p class="mf_request">' . $ui['request'] . '</p>', 'content'); // action line $GLOBALS['page']->add('<p class="mf_action_line">' . '<a href="' . $url->getUrl('op=approveuser&id_friend=' . $ui['id']) . '&action=1" ' . ' title="' . $lang->def('_TITLE_APPROVE_FRIEND') . ' : ' . $profile->resolveUsername() . '">"' . $lang->def('_APPROVE_FRIEND') . '"</a> , ' . '<a href="' . $url->getUrl('op=approveuser&id_friend=' . $ui['id']) . '&action=2" ' . ' title="' . $lang->def('_TITLE_APPROVE_FRIEND_ADD_MYLIST') . ' : ' . $profile->resolveUsername() . '">"' . $lang->def('_APPROVE_FRIEND_ADD_TO_MYLIST') . '"</a> , ' . '<a href="' . $url->getUrl('op=approveuser&id_friend=' . $ui['id']) . '&action=0" ' . ' title="' . $lang->def('_TITLE_REFUSE_FRIEND') . ' : ' . $profile->resolveUsername() . '">"' . $lang->def('_REFUSE_FRIEND') . '"</a>' . '</p>', 'content'); } $GLOBALS['page']->add('</div>', 'content'); }
/** * this course simply print the course box, we need to provide all the information , * this function only display the information collected by other function * @param array $cinfo it must containt [ idCourse, code, name, description, create_date, * number_of_subscription, type_of, materials, demo, teacher_list, score, if_user_alredy_scored_this, * prize, is_sell, alredy_subscribed, type_of_subscription * * idCourse, course_type, idCategory, code, name, description, lang_code, difficult, * subscribe_method, date_begin, date_end, max_num_subscribe, * selling, prize, create_date, course_status, course_edition, * classrooms, course_demo, course_vote, enrolled * * @param int $index the number of object visualized */ function dashcourse(&$url, &$lang, &$cinfo, $uc_status, $index, $enable_actions = true, $h_number = 2) { $has_edition = $cinfo['course_edition']; YuiLib::load(array('animation' => 'my_animation')); $course_type = $cinfo['course_type']; $action = relationWithCourse($cinfo['idCourse'], $cinfo, $uc_status, false); $there_material = array(); $lang_c =& DoceboLanguage::createInstance('course', 'lms'); if (!defined("_ECOM_CURRENCY")) { $currency_label = getPLSetting("ecom", "currency_label", ""); define("_ECOM_CURRENCY", $currency_label); } $cs = array(CST_PREPARATION => $lang_c->def('_CST_PREPARATION', 'course', 'lms'), CST_AVAILABLE => $lang_c->def('_CST_AVAILABLE', 'course', 'lms'), CST_EFFECTIVE => $lang_c->def('_CST_CONFIRMED', 'course', 'lms'), CST_CONCLUDED => $lang_c->def('_CST_CONCLUDED', 'course', 'lms'), CST_CANCELLED => $lang_c->def('_CST_CANCELLED', 'course', 'lms')); if ($cinfo['img_material'] != '') { $there_material[] = '&id_course=' . $cinfo['idCourse']; } $html = '<div class="course_container' . (Get::sett('use_social_courselist') == 'on' ? ' double_height' : ' normal_height') . ($index == 0 ? ' course_container_first' : '') . '">'; $html .= '<div class="course_info_container">' . '<h' . $h_number . '>' . ($cinfo['lang_code'] ? '<img src="' . getPathImage('cms') . 'language/' . $cinfo['lang_code'] . '.png" alt="' . $cinfo['lang_code'] . '" /> ' : '') . $cinfo['name'] . '</h' . $h_number . '>'; if ($cinfo['classrooms'] != '') { $html .= str_replace(array('[classrooms_name]', '[classrooms_location]'), array($cinfo['classrooms']['classroom'], $cinfo['classrooms']['location']), $lang->def('_IN_THE_CLASSROOM')); } // ----------------------------------------------------------------- if (!$has_edition) { $html .= '<p class="course_support_info">'; // number of subscription not limited if ($cinfo['max_num_subscribe'] == 0) { $html .= str_replace(array('[course_type]', '[create_date]', '[enrolled]', '[course_status]'), array($course_type, createDateDistance($cinfo['create_date'], 'catalogue', true), $cinfo['enrolled'], $cs[$cinfo['course_status']]), $lang->def('_COURSE_INTRO')) . ' [' . $cinfo['code'] . '] '; } else { // limited number of subscription $html .= str_replace(array('[course_type]', '[create_date]', '[enrolled]', '[course_status]', '[max_subscribe]'), array($course_type, createDateDistance($cinfo['create_date'], 'catalogue', true), $cinfo['enrolled'], $cs[$cinfo['course_status']], $cinfo['max_num_subscribe']), $lang->def('_COURSE_INTRO_WITH_MAX')); if ($cinfo['enrolled'] >= $cinfo['max_num_subscribe'] && $cinfo['allow_overbooking'] == '1') { // limited number of subscription reached $html .= '<br/>' . $lang->def('_CAN_JOIN_WAITING_LIST'); } } if ($cinfo['min_num_subscribe'] != 0) { $html .= '<br/>' . str_replace('[min_subscribe]', $cinfo['min_num_subscribe'], $lang->def('_MIN_SUBSCRIBE_FOR_COURSE')); } $html .= '</p>'; } // -------------------- if (trim($cinfo['description']) == '') { $html .= ''; } elseif (strpos($cinfo['description'], '<p') === false) { $html .= '<p class="course_description">' . $cinfo['description'] . '</p>'; } else { $html .= '<div class="course_description">' . $cinfo['description'] . '</div>'; } if (empty($cinfo['edition_list']) && $has_edition) { $html .= '<img src="' . getPathImage('lms') . 'coursecatalogue/editions.png" alt="' . $lang->def('_EDITIONs') . '" /> ' . $lang->def('_NO_CONTENT'); } elseif ($has_edition) { // edition list actions --------------------------------------------------- $html .= '<p class="editions_actions">'; $html .= '<img src="' . getPathImage('lms') . 'coursecatalogue/editions.png" alt="' . $lang->def('_EDITIONs') . '" /> '; $html .= '<a id="course_edition_' . $cinfo['idCourse'] . '_open" class="course_editions_expand" href="javascript:;" onclick=" YAHOO.Animation.BlindIn(\'course_edition_' . $cinfo['idCourse'] . '\', \'\'); YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_open\').style.display = \'none\'; YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_close\').style.display = \'inline\'; return false;">' . str_replace(array('[edition_count]', '[edition_available]'), array(count($cinfo['edition_list']), $cinfo['edition_available']), $lang->def('_SHOW_COURSE_EDITION')) . '</a>'; $html .= '<a id="course_edition_' . $cinfo['idCourse'] . '_close" class="course_editions_collapse" href="javascript:;" onclick=" YAHOO.Animation.BlindOut(\'course_edition_' . $cinfo['idCourse'] . '\'); YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_close\').style.display = \'none\'; YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_open\').style.display = \'inline\'; return false;">' . $lang->def('_HIDE_COURSE_EDITION') . '</a>' . '</p>'; // edition list show ------------------------------------------------------------------------- $html .= '<ul id="course_edition_' . $cinfo['idCourse'] . '" class="course_editions">'; while (list($id_edition, $ed_info) = each($cinfo['edition_list'])) { if ($ed_info['img_material'] != '') { $there_material[] = '&id_course=' . $cinfo['idCourse'] . '&edition_id' . $ed_info['idCourseEdition']; } $html .= '<li><b class="course_title">[' . $ed_info['code'] . '] ' . $ed_info['name'] . '</b><p>'; if ($ed_info['date_begin'] != '0000-00-00' && $ed_info['date_end'] != '0000-00-00' || $ed_info['classrooms'] != '') { $html .= $lang->def('_EDITIONS'); } if ($ed_info['date_begin'] != '0000-00-00' && $ed_info['date_end'] != '0000-00-00') { $html .= ' ' . str_replace(array('[date_begin]', '[date_end]'), array(Format::date($ed_info['date_begin'], 'date'), Format::date($ed_info['date_end'], 'date')), $lang->def('_EDTION_TIME')); } if ($ed_info['classrooms'] != '') { $html .= str_replace(array('[classrooms_name]', '[classrooms_location]'), array($ed_info['classrooms']['classroom'], $ed_info['classrooms']['location']), $lang->def('_IN_THE_CLASSROOM')); } if ($ed_info['date_begin'] != '0000-00-00' && $ed_info['date_end'] != '0000-00-00' || $ed_info['classrooms'] != '') { $html .= '<br />'; } if ($ed_info['max_num_subscribe'] == 0) { $html .= str_replace(array('[user_count]', '[waiting_count]', ' su [max_user]'), array($ed_info['user_count'], $ed_info['waiting'], ''), $lang->def('_USER_EDITION_SUBSCRIBE')) . '</p>'; } else { $html .= str_replace(array('[user_count]', '[waiting_count]', '[max_user]'), array($ed_info['user_count'], $ed_info['waiting'], $ed_info['max_num_subscribe']), $lang->def('_USER_EDITION_SUBSCRIBE')) . '</p>'; } if ($ed_info['user_count'] != '' && $ed_info['date_end'] != '0000-00-00' || $ed_info['classrooms'] != '') { $html .= '<br />'; } // number of subscription not limited /*if($ed_info['max_num_subscribe'] == 0) { $html .= str_replace( array('[user_count]', '[waiting_count]', ' su [max_user]'), array($ed_info['user_count'], $ed_info['waiting'], ''), $lang->def('_USER_EDITION_SUBSCRIBE') ); } else { // limited number of subscription $html .= str_replace( array('[user_count]', '[max_subscribe]', '[waiting_count]'), array($ed_info['user_count'], $ed_info['max_num_subscribe'], $ed_info['waiting']), $lang->def('_USER_EDITION_SUBSCRIBE_WITH_MAX') ); if($ed_info['user_count'] >= $ed_info['max_num_subscribe'] && $ed_info['allow_overbooking'] == '1') { // limited number of subscription reached $html .= '<br/>'.$lang->def('_CAN_JOIN_WAITING_LIST'); } } if($ed_info['min_num_subscribe'] != 0) { $html .= '<br/>'.str_replace('[min_subscribe]', $cinfo['min_num_subscribe'], $lang->def('_MIN_SUBSCRIBE_FOR_EDITION')); } $html .= '</p>';*/ // theacher list ---------------------------------------------------------- if (Get::sett('use_social_courselist') == 'on') { if (isset($ed_info['theacher_list']) && is_array($ed_info['theacher_list']) && !empty($ed_info['theacher_list'])) { $html .= '<h3 class="course_teacher_list">' . $lang->def('_THEACER_LIST') . '</h3>' . '<ul class="course_teacher_list">'; while (list(, $id_teach) = each($ed_info['theacher_list'])) { $profile = new UserProfile($id_teach); $profile->init('profile', 'framework', '', 'ap'); $html .= '<li class="the_course">' . '<a href="' . $url->getUrl('op=showprofile&id_course=' . $cinfo['idCourse'] . '&id_user='******'">' . $profile->getUserPhotoOrAvatar('micro') . ' ' . $profile->resolveUsername() . '</a></li>'; } $html .= '</ul>'; } } $html .= '</li>'; } $html .= '</ul>'; $html .= '<script type="text/javascript"> YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '\').style.display = \'none\'; YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_close\').style.display = \'none\'; </script>'; } elseif (Get::sett('use_social_courselist') == 'on') { // theacher list ---------------------------------------------------------- if (isset($cinfo['theacher_list']) && is_array($cinfo['theacher_list']) && !empty($cinfo['theacher_list'])) { $html .= '<h3 class="course_teacher_list">' . $lang->def('_THEACER_LIST') . '</h3>' . '<ul class="course_teacher_list">'; while (list(, $id_teach) = each($cinfo['theacher_list'])) { $profile = new UserProfile($id_teach); $profile->init('profile', 'framework', '', 'ap'); $html .= '<li>' . '<a href="' . $url->getUrl('op=showprofile&id_course=' . $cinfo['idCourse'] . '&id_user='******'">' . $profile->getUserPhotoOrAvatar('micro') . ' ' . $profile->resolveUsername() . '</a></li>'; } $html .= '</ul>'; } } // course related extra option --------------------------------------------- if (Get::sett('use_social_courselist') == 'on' || !empty($there_material) || $cinfo['course_demo'] != '') { $html .= '<ul class="course_related_actions">'; if (Get::sett('use_social_courselist') == 'on') { $html .= '<li class="course_comment">' . '<a href="javascript:;" onclick="openComment(\'' . $cinfo['idCourse'] . '\'); return false;">' . '<span>' . $lang->def('_COMMENTS') . ' (' . (isset($cinfo['comment_count']) ? $cinfo['comment_count'] : '0') . ')</span></a></li>'; } // the course material ----------------------------------------------------------------- if (!empty($there_material)) { if (count($there_material) == 1) { // direct download of material ------------------------------------------------- $html .= '<li class="course_materials">' . '<a href="' . $url->getUrl('op=donwloadmaterials' . array_pop($there_material)) . '">' . '<span>' . $lang->def('_MATERIALS') . '</span></a></li>'; } else { // popup download of material -------------------------------------------------- $html .= '<li class="course_materials">' . '<a href="javascript:;" onclick="openWindowWithAction(\'' . $cinfo['idCourse'] . '\', \'course_materials\'); return false;">' . '<span>' . $lang->def('_MATERIALS') . '</span></a></li>'; } } // the course demo link ---------------------------------------------------------------- if ($cinfo['course_demo'] != '') { require_once _base_ . '/lib/lib.multimedia.php'; $ext = end(explode('.', $cinfo['course_demo'])); if (isPossibleEmbedPlay('/appLms/' . Get::sett('pathcourse'), $cinfo['course_demo'], $ext)) { // play demo in popup --------------------------------------------------------- $html .= '<li class="course_demo">' . '<a href="javascript:;" onclick="openWindowWithAction(\'' . $cinfo['idCourse'] . '\', \'play_demo\'); return false;">' . '<span>' . $lang->def('_DEMO') . '</span></a></li>'; } else { // download demo -------------------------------------------------------------- $html .= '<li class="course_demo">' . '<a href="' . $url->getUrl('op=showdemo&id_course=' . $cinfo['idCourse']) . '">' . '<span>' . $lang->def('_DEMO') . '</span></a></li>'; } } $html .= '</ul>'; } $html .= '</div>'; // score and subscribe action ---------------------------------------------- $html .= '<ul class="course_score">'; if ($enable_actions) { if ($has_edition) { list($edition_for_enter) = sql_fetch_row(sql_query("SELECT edition_id" . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser" . " WHERE idUser = '******'" . " AND idCourse = '" . $cinfo['idCourse'] . "'" . " ORDER BY edition_id DESC" . " LIMIT 0,1")); } if ($cinfo['first_is_scorm'] != false && $cinfo['direct_play']) { $lb_param = ""; if ($cinfo['first_is_scorm'][0] != '' && $cinfo['first_is_scorm'][0] != '0') { $lb_param .= ";width=" . $cinfo['first_is_scorm'][0] . ""; } if ($cinfo['first_is_scorm'][1] != '' && $cinfo['first_is_scorm'][1] != '0') { $lb_param .= ";height=" . $cinfo['first_is_scorm'][1] . ""; } } if ($action[0] == 'subscribed') { $access = Man_Course::canEnterCourse($cinfo); } $html .= '<li id="action_of_' . $cinfo['idCourse'] . '" class="third_action ' . $action[0] . '">' . ($action[1] != false ? '<a href="javascript:;"' . ' onclick="openWindowWithAction(\'' . $cinfo['idCourse'] . '\', \'course_action_confirm' . ($has_edition ? '_edition' : '') . '\'); return false;">' : '') . ($action[0] == 'subscribed' && $access['can'] ? '<a href="index.php?modname=course&op=aula&idCourse=' . $cinfo['idCourse'] . ($has_edition ? '&id_e=' . $edition_for_enter : '') . '"' . ($cinfo['direct_play'] == 1 && $cinfo['level'] <= 3 && $cinfo['first_is_scorm'] ? ' rel="shadowbox' . $lb_param . '" title="' . $cinfo['name'] . '"' : ' title="' . $lang->def('_ENTER') . '"') . '>' . $lang->def('_ENTER') . '</a>' : $lang->def('_' . strtoupper($action[0])) . '<br />'); switch ($action[0]) { case "can_buy": case "can_reserve": $html .= $cinfo['prize'] . ' ' . _ECOM_CURRENCY; break; } $html .= ($action[2] != false ? '<img src="' . getPathImage() . 'coursecatalogue/' . $action[2] . '" ' . 'alt="' . $lang->def('_ALT_' . strtoupper($action[0])) . '"/>' : '') . ($action[1] != false ? '</a>' : '') . '</li>'; } if (Get::sett('use_social_courselist') == 'on') { $html .= '<li class="current_score"><span>' . $lang->def('_SCORE') . '</span><br />' . '<strong id="course_score_' . $cinfo['idCourse'] . '">' . $cinfo['course_vote'] . '</strong></li>'; if ($uc_status != false && $uc_status['waiting'] == 0) { $html .= '<li class="score_it">' . '<a class="good" href="javascript:;" ' . 'onclick="course_vote(\'' . $cinfo['idCourse'] . '\', \'good\'); return false;" ' . 'title="' . $lang->def('_VOTE_GOOD_TITLE') . '">' . '<img id="score_image_good_' . $cinfo['idCourse'] . '" src="' . getPathImage() . 'coursecatalogue/good' . ($cinfo['user_score'] == '1' ? '_grey' : '') . '.png" alt="' . $lang->def('_VOTE_GOOD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" />' . '</a> ' . '<a class="bad" href="javascript:;" ' . 'onclick="course_vote(\'' . $cinfo['idCourse'] . '\', \'bad\'); return false;" ' . 'title="' . $lang->def('_VOTE_BAD_TITLE') . '">' . '<img id="score_image_bad_' . $cinfo['idCourse'] . '" src="' . getPathImage() . 'coursecatalogue/bad' . ($cinfo['user_score'] == '-1' ? '_grey' : '') . '.png" alt="' . $lang->def('_VOTE_BAD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" />' . '</a>' . '</li>'; } else { $html .= '<li class="score_it" id="score_action_' . $cinfo['idCourse'] . '">' . '<img src="' . getPathImage() . 'coursecatalogue/good_grey.png" alt="' . $lang->def('_VOTE_GOOD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" /> ' . '<img src="' . getPathImage() . 'coursecatalogue/bad_grey.png" alt="' . $lang->def('_VOTE_BAD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" />' . '</li>'; } } $html .= '</ul>'; $html .= '</div>'; return $html; }