Пример #1
0
 function subscribedUser()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.navbar.php';
     require_once _base_ . '/lib/lib.table.php';
     $lang =& DoceboLanguage::createInstance('reservation');
     $mod_perm = checkPerm('mod', true);
     $id_course = $_SESSION['idCourse'];
     $order_by = importVar('order_by', false, 'c.name, e.title, e.date, e.deadLine');
     $out = $GLOBALS['page'];
     $out->setWorkingZone('content');
     $man_res = new Man_Reservation();
     $acl =& Docebo::user()->getAcl();
     $user_idst = getLogUserId();
     $events = array();
     $events = $man_res->viewEventsForSubscribedTab($id_course, $order_by);
     $out->add('<center>' . Form::openForm('form_event', 'index.php?modname=reservation&amp;op=reservation') . Form::getButton('add_event', 'add_event', $lang->def('_NEW_EVENT')) . Form::getButton('category_gestion', 'category_gestion', $lang->def('_CATEGORY_GESTION')) . Form::getButton('location_gestion', 'location_gestion', $lang->def('_LOCATION_GESTION')) . Form::closeForm() . '</center>');
     $out->add('<br/>');
     if ($events) {
         $cont_h = array(isset($_GET['order_by']) && $_GET['order_by'] == 'c.name, e.title' ? '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, e.title DESC">' . $lang->def('_TITLE') . '</a>' : '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, e.title">' . $lang->def('_TITLE') . '</a>', isset($_GET['order_by']) && $_GET['order_by'] == 'c.name, l.name' ? '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, l.name DESC">' . $lang->def('_LOCATION') . '</a>' : '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, l.name">' . $lang->def('_LOCATION') . '</a>', isset($_GET['order_by']) && $_GET['order_by'] == 'c.name, e.date' ? '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, e.date DESC">' . $lang->def('_DATE') . '</a>' : '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, e.date">' . $lang->def('_DATE') . '</a>', $lang->def('_NUMBER_SUBSCRIBED'), isset($_GET['order_by']) && $_GET['order_by'] == 'c.name, e.deadLine' ? '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, e.deadLine DESC">' . $lang->def('_DEADLINE') . '</a>' : '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, e.deadLine">' . $lang->def('_DEADLINE') . '</a>');
         $type_h = array('', '', '', '', '');
         if ($mod_perm) {
             $type_h = array('', '', '', '', '', 'image', 'image', 'image', 'image', 'image', 'image');
             $cont_h = array(isset($_GET['order_by']) && $_GET['order_by'] == 'c.name, e.title' ? '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, e.title DESC">' . $lang->def('_TITLE') . '</a>' : '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, e.title">' . $lang->def('_TITLE') . '</a>', isset($_GET['order_by']) && $_GET['order_by'] == 'c.name, l.name' ? '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, l.name DESC">' . $lang->def('_LOCATION') . '</a>' : '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, l.name">' . $lang->def('_LOCATION') . '</a>', isset($_GET['order_by']) && $_GET['order_by'] == 'c.name, e.date' ? '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, e.date DESC">' . $lang->def('_DATE') . '</a>' : '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, e.date">' . $lang->def('_DATE') . '</a>', $lang->def('_NUMBER_SUBSCRIBED'), isset($_GET['order_by']) && $_GET['order_by'] == 'c.name, e.deadLine' ? '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, e.deadLine DESC">' . $lang->def('_DEADLINE') . '</a>' : '<a href="index.php?modname=reservation&op=reservation&amp;active_tab=subscribed_user&amp;order_by=c.name, e.deadLine">' . $lang->def('_DEADLINE') . '</a>', '<img src="' . getPathImage() . '/standard/identity.png" title="' . $lang->def('_VIEW_USER_SUBSCRIBED') . '" alt="' . $lang->def('_ENROL_COUNT') . '" />', '' . $lang->def('_ADD_USER') . '', '<img src="' . getPathImage() . '/standard/msg_unread.png" title="' . $lang->def('_ALT_SEND_MAIL') . '" alt="' . $lang->def('_ALT_SEND_MAIL') . '" />', '<img src="' . getPathImage() . '/standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . '/standard/delete.png" title="' . $lang->def('ALT_DEL') . '" alt="' . $lang->def('_DEL') . '" />', '<img src="' . getPathImage() . '/standard/moduser.png" title="' . $lang->def('_SET_ROOM_VIEW_PERM') . '" alt="' . $lang->def('_SET_ROOM_VIEW_PERM') . '" />');
         }
         $tb = new Table(100000);
         $tb->setColsStyle($type_h);
         $tb->addHead($cont_h);
         $temp_cat = '';
         foreach ($events as $event) {
             if ($temp_cat != $event[EVENT_CATEGORY_NAME]) {
                 if ($temp_cat != '') {
                     $out->add($tb->getTable());
                     $out->add('<br/>');
                 }
                 $temp_cat = $event[EVENT_CATEGORY_NAME];
                 $table_caption = $event[EVENT_CATEGORY_NAME];
                 $max_subscription = $man_res->getMaxSubscriptionForCategory($event[EVENT_ID_CATEGORY]);
                 if ($max_subscription) {
                     $table_caption .= ' : ' . $lang->def('_MAX_SUBSCRIPTION_FOR_CATEGORY') . ' : ' . $max_subscription;
                 }
                 $tb = new Table(100000, $table_caption);
                 $tb->setColsStyle($type_h);
                 $tb->addHead($cont_h);
             }
             $count = array();
             $count[] = $event[EVENT_TITLE];
             if ($event[EVENT_ID_LABORATORY]) {
                 $count[] = '<a href="index.php?modname=reservation&amp;op=info_location&amp;active_tab=subscribed_user&amp;id_location=' . $event[EVENT_ID_LABORATORY] . (isset($_GET['order_by']) ? '&amp;order_by=' . $_GET['order_by'] : '') . '">' . $event[EVENT_LABORATORY_NAME] . '</a>';
             } else {
                 $count[] = $event[EVENT_LABORATORY_NAME];
             }
             $count[] = Format::date($event[EVENT_DATE], 'date');
             $count[] = $event[EVENT_USER_SUBSCRIBED] . '/' . $event[EVENT_MAX_USER];
             $count[] = Format::date($event[EVENT_DEADLINE], 'date');
             if ($mod_perm) {
                 $count[] = '<a href="index.php?modname=reservation&amp;op=view_user_event&amp;id_event=' . $event[EVENT_ID] . '"><img src="' . getPathImage() . '/standard/identity.png" title="' . $lang->def('_VIEW_USER_SUBSCRIBED') . '" alt="' . $lang->def('_ENROL_COUNT') . '" /></a>';
                 $count[] = '<a href="index.php?modname=reservation&amp;op=add_registration&amp;id_event=' . $event[EVENT_ID] . '&amp;id_course=' . $event[EVENT_ID_COURSE] . '">' . $lang->def('_ADD_USER') . '</a>';
                 $count[] = '<a href="index.php?modname=reservation&amp;op=send_mail&amp;id_event=' . $event[EVENT_ID] . '&amp;id_course=' . $event[EVENT_ID_COURSE] . '"><img src="' . getPathImage() . '/standard/msg_unread.png" title="' . $lang->def('_ALT_SEND_MAIL') . '" alt="' . $lang->def('_ALT_SEND_MAIL') . '" /></a>';
                 $count[] = '<a href="index.php?modname=reservation&amp;op=mod_event&amp;id_event=' . $event[EVENT_ID] . '"><img src="' . getPathImage() . '/standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" /></a>';
                 $count[] = '<a href="index.php?modname=reservation&amp;op=del_event&amp;id_event=' . $event[EVENT_ID] . '"><img src="' . getPathImage() . '/standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" /></a>';
                 $count[] = '<a href="index.php?modname=reservation&amp;op=set_room_view_perm&amp;id_event=' . $event[EVENT_ID] . '"><img src="' . getPathImage() . 'standard/moduser.png" alt="' . $lang->def('_SET_ROOM_VIEW_PERM') . '" title="' . $lang->def('_SET_ROOM_VIEW_PERM') . '" /></a>';
             }
             $tb->addBody($count);
         }
         $out->add($tb->getTable() . '</div>');
     } else {
         $out->add($lang->def('_NO_RESERVATION_FOUND'), 'content');
     }
 }