コード例 #1
0
ファイル: cabinet.php プロジェクト: Jluct/obuceisea
 static function getUserProgress($id = 0, $complete = 0)
 {
     $data = R::duplicate($_SESSION['user']);
     $out = "<div class='col-sm-12'>\r\n            <div class=\"list-group\"><ul style='padding-left:0;'>";
     $out .= "<li class=\"list-group-item active\">";
     if ($id == 0 && $complete == 0) {
         $out .= "<h4 class=\"list-group-item-heading \"><a role='button' href='?ctrl=cabinet&action=GetCabinet' class='btn btn-info back_button'><span class=\"glyphicon glyphicon-arrow-left\" aria-hidden=\"true\"></span></a>В кабинет </h4>";
     }
     if ($complete == 1) {
         $out .= "<h4 class=\"list-group-item-heading \"><a role='button' href='?ctrl=cabinet&action=GetCabinet' class='btn btn-info back_button'><span class=\"glyphicon glyphicon-arrow-left\" aria-hidden=\"true\"></span></a>В кабинет</h4>";
     }
     if ($id != 0) {
         $out .= "<h4 class=\"list-group-item-heading \"><a role='button' href='?ctrl=cabinet&action=GetUserInformation' class='btn btn-info back_button'><span class=\"glyphicon glyphicon-arrow-left\" aria-hidden=\"true\"></span></a>Вернуться к списку</h4>";
     }
     //?ctrl=cabinet&action=GetUserInformation
     $out .= '</li></ul></div>';
     if ($id == 0) {
         $preWisdom = $data->ownInformation_userList;
         $arrayId = array();
         foreach ($preWisdom as $value) {
             if ($complete == 0) {
                 if (is_null($value->status) && is_null($value->education_id) && is_null($value->lesson_id)) {
                     $arrayId[] = $value->information_id;
                 }
             } else {
                 if (!is_null($value->status) && is_null($value->education_id) && is_null($value->lesson_id)) {
                     $arrayId[] = $value->information_id;
                 }
             }
         }
         $wisdom = R::loadAll('information', $arrayId);
     } else {
         // проверяем записан ли пользователь на данный УМ
         $userInfo = $data->ownInformation_userList;
         foreach ($userInfo as $value) {
             if ($value->information_id == $id) {
                 $wisdom = R::findAll('information', 'where id = ?', [$id]);
             }
         }
     }
     $typeMenu = '6';
     $typeMenu1 = '';
     if ($complete == 0) {
         if ($id === 0) {
             switch ($_SESSION['user']->status) {
                 case "student":
                     $typeMenu = 3;
                     $typeMenu1 = '';
                     break;
                 case "teacher":
                     $typeMenu = 7;
                     $typeMenu1 = 8;
                     break;
                 case "moderator":
                     $typeMenu = 4;
                     //                        $typeMenu1=8;
                     break;
                 case "admin":
                     $typeMenu = 9;
                     $typeMenu1 = 8;
                     break;
             }
         }
     }
     $bigMenu = new menu("SELECT menu_item.*\r\n        FROM  `menu` ,  `menu_item`\r\n        WHERE menu_item.menu_id = ?\r\n       AND menu.menu_id = menu_item.menu_id", [$typeMenu]);
     $bigMenu->ul_tpl = "<ul class=\"nav nav-tabs nav-justified menu_heavy\">";
     if (!empty($wisdom)) {
         foreach ($wisdom as $item) {
             $typeData = wisdom::getType($item);
             if ($typeData[3]->id == 6 && $id != 0) {
                 header('Location:?ctrl=wisdom&action=GetWisdomById&id=' . $id);
             }
             if ($id != 0) {
                 $itemClone = '';
                 if ($typeData[3]->id != 1) {
                     $itemClone = $item;
                 }
                 $modul = self::getInfoEducation($item, $itemClone);
             }
             if ($_SESSION['user']->status !== 'author') {
                 $autor = wisdom::getAuthorName($item->id);
                 $author = "<br><a  href='?ctrl=cabinet&action=UserInfo&id=" . $autor['id'] . "'>" . $autor['login'] . "</a> |\r\n                    <a  href='?ctrl=cabinet&action=UserInfo&id=" . $autor['id'] . "'> " . $autor['surname'] . " " . $autor['name'] . " " . $autor['andername'] . " </a> ";
             }
             $short_description = !empty($item->shortdescription) ? $item->shortdescription : 'Краткое описание отсутствует';
             $out .= "<li class=\"list-group-item\">\r\n                <ol class=\"breadcrumb\">\r\n                    <li><a href=\"?ctrl=wisdom&action=WisdomType&type=" . $typeData[3]->id . "&page=1\" > " . $typeData[3]->name . "</a></li>\r\n                    <li><a href=\"?ctrl=wisdom&action=WisdomType&type=" . $typeData[3]->id . "&subtype=" . $typeData[2]->id . "&page=1\" > " . $typeData[2]->name . "</a></li>\r\n                    <li><a href=\"?ctrl=wisdom&action=WisdomType&type=" . $typeData[3]->id . "&subtype=" . $typeData[2]->id . "&category=" . $typeData[1]->id . "&page=1\" > " . $typeData[1]->name . "</a></li>\r\n                    <li><a href=\"?ctrl=wisdom&action=WisdomType&type=" . $typeData[3]->id . "&subtype=" . $typeData[2]->id . "&category=" . $typeData[1]->id . "&subcategory=" . $typeData[0]->id . "&page=1\" > " . $typeData[0]->name . "</a></li>\r\n\r\n                </ol>\r\n            <h4 class=\"list-group-item-heading\"><a href='?ctrl=wisdom&action=GetWisdomById&id=" . $item->id . "'>" . $item->name . "</a></h4><h5>" . $author . "</h5>\r\n    <p class=\"list-group-item-text\">" . $short_description . "</p>" . $modul;
             if ($id === 0) {
                 $bigMenu->li_tpl = "<li  class=\"dropdown primary\"  role=\"presentation\"><a data-toggle=\"tooltip\" href='%s" . $item->id . "'>%s %s</a>%s</li>";
                 $out .= $bigMenu->render();
             }
             if ($_SESSION['user']->status !== 'student' && !empty($_SESSION['user']->status) && $id != 0) {
                 $out .= "<a role='button' href='?ctrl=teacher&action=AddModul&id=" . $id . "' class='btn btn-info btn-block'>Добавить модуль</a>";
             }
             $out .= "</li>";
             $out .= "</ul></div></div></div>";
         }
     }
     if (empty($wisdom)) {
         $out .= "Вы не подписанны на данный учебный материал";
     }
     return $out;
 }
コード例 #2
0
ファイル: header.php プロジェクト: Jluct/obuceisea
require_once __DIR__ . '/authorization.php';
?>
            </div>
        </div>
        <div class="row menu_heavy">
            <div class="col-sm-2">
                <img class="logo_img" src="images/logo.jpg">
<!--                Обучайся!-->
            </div>
            <div class="col-sm-9 actual_menu">

                <?php 
$bigMenu = new menu("SELECT menu_item.*\r\n        FROM  `menu` ,  `menu_item`\r\n        WHERE menu_item.menu_id = ?\r\n       AND menu.menu_id = menu_item.menu_id", [2]);
$bigMenu->ul_tpl = "<ul class=\"nav nav-tabs nav-justified menu_heavy\">";
$bigMenu->li_tpl = "<li  class=\"dropdown\"  role=\"presentation\"><a data-toggle=\"tooltip\" href='%s'>%s %s</a>%s</li>";
echo $bigMenu->render();
?>
            </div>
            <div class="col-sm-1">
                <button class="btn btn-block btn_search">Поиск</button>
            </div>
        </div>

        <?php 
// print_r($messageData);
?>

        <?php 
if (!empty($message)) {
    $mes = new messager($message[0]);
    $mes->setMessageControl(true)->setHeader($message[1])->setTplClassVariable($message[2]);