コード例 #1
0
ファイル: conference.php プロジェクト: abhinay100/forma_app
function conference_list(&$url)
{
    checkPerm('view');
    //$mod_perm = checkPerm('mod');
    $lang =& DoceboLanguage::createInstance('conference', 'lms');
    require_once _base_ . '/lib/lib.table.php';
    require_once $GLOBALS['where_scs'] . '/lib/lib.booking.php';
    $idCourse = $_SESSION['idCourse'];
    $conference = new Conference_Manager();
    $re_room = $conference->roomActive($_SESSION['idCourse'], fromDatetimeToTimestamp(date("Y-m-d H:i:s")));
    $room_number = $conference->totalRoom($re_room);
    if (checkPerm('mod', true)) {
        cout('<div class="yui-navset yui-navset-top tab_block">
			<ul class="yui-nav">
				<li class="first selected">
					<a href="index.php?modname=conference&amp;op=show">
						<em>' . Lang::t('_ACTIVE', 'conference') . '</em>
					</a>
				</li>
				<li>
					<a href="index.php?modname=conference&amp;op=history">
						<em>' . Lang::t('_HISTORY', 'conference') . '</em>
					</a>
				</li>
			</ul>
			<div class="yui-content">', 'content');
    } else {
        cout(getTitleArea($lang->def('_VIDEOCONFERENCE'), 'conference') . '<div class="std_block">', 'content');
    }
    if ($room_number == 0) {
        // no rooms
        $GLOBALS['page']->add('<b id="noroom">' . $lang->def('_NO_ROOM_AVAILABLE') . '</b>', 'content');
    } else {
        // list rooms active in this moment
        $tb = new Table(0, $lang->def('_ROOMS_AVAILABLE'), $lang->def('_SUMMARY_ROOM_AVAILABLE'));
        $cont_h = array($lang->def('_VIDEOCONFERENCE'), $lang->def('_START_DATE'), $lang->def('_MEETING_HOURS'), $lang->def('_ENTER'));
        $type_h = array('table_main_colum', 'align_center nowrap', 'align_center nowrap', 'align_center');
        if (checkPerm('mod', true)) {
            /*$cont_h[] = '';
            			$type_h[] = 'image';
            */
            $cont_h[] = '';
            $type_h[] = 'image';
            $cont_h[] = '';
            $type_h[] = 'image';
        }
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $acl_manager =& Docebo::user()->getAclManager();
        $display_name = Docebo::user()->getUserName();
        $u_info = $acl_manager->getUser(getLogUserId(), false);
        $user_email = $u_info[ACL_INFO_EMAIL];
        while ($room = $conference->nextRow($re_room)) {
            $room_id = $room["id"];
            $cont = array();
            $cont[] = $room["name"] . " (" . $room["room_type"] . ")";
            $start_date = Format::date(date("Y-m-d H:i:s", $room["starttime"]), 'datetime');
            $cont[] = $start_date;
            $cont[] = $room["meetinghours"];
            $now = time();
            /*$booking = new RoomBooking();
            
            			$user_booked = $booking->userIsBooked(getLogUserId(), $room["id"]);
            			$user_valid = $booking->userIsValid(getLogUserId(), $room["id"]);
            			$room_full = $booking->roomIsFull($room["id"]);
            
            			if ($room["endtime"]>=$now && $room["starttime"]<=$now && $user_booked && $user_valid)
            				$cont[]=$conference->getUrl($room["id"],$room["room_type"]);
            			elseif($user_booked && $user_valid)
            				$cont[] = $lang->def('_WAITING_START');
            			elseif($room_full)
            				$cont[] = $lang->def('_ROOM_FULL');
            			elseif($user_booked && !$user_valid)
            				$cont[] = $lang->def('_PENDING_VALIDATION');
            			elseif($room['bookable'])
            				$cont[]='<a href="index.php?modname=conference&amp;op=booking&id='.$room["id"].'">'.$lang->def('_BOOKING_CONFERENCE').'</a>';
            			elseif ($room["endtime"]>=$now && $room["starttime"]<=$now)
            				$cont[]=$conference->getUrl($room["id"],$room["room_type"]);
            			else
            				$cont[] = $lang->def('_WAITING_START');
            */
            $cont[] = $conference->getUrl($room["id"], $room["room_type"]);
            if (checkPerm('mod', true)) {
                if (getLogUserId() == $room["idSt"] && $room["room_type"] == 'teleskill') {
                    $cont[] = '<a href="index.php?modname=conference&amp;op=modconf&amp;id=' . $room["id"] . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . strip_tags($room["name"]) . '"><img src="' . getPathImage() . '/standard/edit.png' . '" /></a>';
                } else {
                    $cont[] = '';
                }
                /*
                				if (getLogUserId()==$room["idSt"])
                					$cont[] =	'<a href="index.php?modname=conference&amp;op=modbooking&amp;id='.$room["id"].'" title="'.$lang->def('_MOD_BOOKING').' : '.strip_tags($room["name"]).'">'
                								.'<img src="'.getPathImage().'/standard/modadmin.gif" alt="'.$lang->def('_MOD_BOOKING').' : '.strip_tags($room["name"]).'">'
                								.'</a>';
                				else
                					$cont[] = '';
                */
                if (getLogUserId() == $room["idSt"]) {
                    $cont[] = '<a href="index.php?modname=conference&amp;op=delconf&id=' . $room["id"] . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . strip_tags($room["name"]) . '"><img src="' . getPathImage() . '/standard/delete.png' . '" /></a>';
                } else {
                    $cont[] = '';
                }
            }
            $tb->addBody($cont);
        }
        // end while
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delconf]');
        $GLOBALS['page']->add($tb->getTable(), 'content');
    }
    // TODO : support for BBB is experimental - must be refined
    if (checkPerm('mod', true)) {
        cout('<br/><div class="table-container-below">', 'content');
        if (Get::sett('code_teleskill') or Get::sett('dimdim_server') and Get::sett('dimdim_user') and Get::sett('dimdim_password') or Get::sett('bbb_server') and Get::sett('bbb_user') and Get::sett('bbb_salt') and Get::sett('bbb_password_moderator') and Get::sett('bbb_password_viewer')) {
            if ($conference->can_create_user_limit(getLogUserId(), $idCourse, time())) {
                cout('<a class="ico-wt-sprite subs_add" href="' . $url->getUrl('op=startnewconf') . '"><span>' . $lang->def('_CREATE') . '</span></a>', 'content');
            } else {
                cout('<b>' . $lang->def('_NO_MORE_ROOM') . '</b>', 'content');
            }
        }
        cout('</div>', 'content');
    }
    if (checkPerm('mod', true)) {
        cout('<div class="nofloat"></div></div></div>', 'content');
    } else {
        cout('</div>', 'content');
    }
}