예제 #1
0
 public function actionGetWisdomById($view)
 {
     $id = (int) $_GET['id'];
     $view->id = $id;
     $view->data = wisdom::getWisdom($id);
     echo $view->render('wisdomId.php');
 }
예제 #2
0
파일: wisdom.php 프로젝트: Jluct/obuceisea
 function getWisdomByType($array, $wisdomArray, $page = 1)
 {
     if (!(int) $array[0]) {
         return false;
     }
     $out = '';
     db_connect::connect();
     if (empty($wisdomArray)) {
         $out .= "<h2>Ничего не найдено</h2>";
         return $out;
     }
     foreach ($wisdomArray as $key => $value) {
         $out .= "<h2>" . $key . "</h2><table class='table table-striped'>\r\n                    <tr>\r\n                        <th>Название</th>\r\n                        <th>Автор</th>\r\n                        <th>Категория</th>\r\n                        <th>Субкатегория</th>\r\n                    </tr>";
         foreach ($value as $smallKey => $subValue) {
             $category = R::load('category', $subValue['subcategory_id']);
             if ($array[3] && $array[2]) {
                 $step = 10;
                 $page3 = ($page - 1) * $step;
                 $data = $category->withCondition('information.category_id = ? LIMIT ?,?', [$array[3], $page3, $step])->ownInformationList;
                 self::$count_data += $category->withCondition('information.category_id = ? LIMIT ?,?', [$array[3], $page3, $step])->countOwn('information');
                 self::$path = "?ctrl=wisdom&action=WisdomType&type=" . $array[0] . "&subtype=" . $array[1] . "&category=" . $array[2] . "&subcategory=" . $array[3];
             } else {
                 $step = 10;
                 $step1 = 2;
                 //                    echo $page;
                 $page2 = ($page - 1) * $step;
                 $page1 = ($page - 1) * $step1;
                 $data = $array[1] ? $category->with(' LIMIT ?,?', [$page2, $step])->ownInformationList : $category->with(' LIMIT ?,?', [$page1, $step1])->ownInformationList;
                 self::$count_data += $array[1] ? $category->with(' LIMIT ?,?', [$page2, $step])->countOwn('information') : $category->with(' LIMIT ?,?', [$page1, $step1])->countOwn('information');
                 //                    echo " ".self::$count_data." ";
                 self::$path = $array[1] ? "?ctrl=wisdom&action=WisdomType&type=" . $array[0] . "&subtype=" . $array[1] : "?ctrl=wisdom&action=WisdomType&type=" . $array[0];
             }
             foreach ($data as $item) {
                 if (!$item && $array[2]) {
                     $out .= "<tr><td colspan='4'><h4 class='text-center'><b>Ничего не найдено</b></h4></td></tr>";
                     continue;
                 }
                 $autor = self::getAuthorName($item->id);
                 $out .= "<tr>\r\n                            <td><a href='?ctrl=wisdom&action=GetWisdomById&id=" . $item->id . "'>" . $item->name . "</a></td>\r\n                            <td><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></td>\r\n                            <td>" . $smallKey . "</td>\r\n                            <td>" . $subValue['category_name'] . "</td>\r\n\r\n                        </tr>";
             }
         }
         $out .= "</table>";
     }
     if ($array[3] && $array[2] && $_SESSION['user']->status == 'teacher' && $_SESSION['user']->block == 0) {
         $out .= "<a role='button' href='?ctrl=teacher&action=WisdomData&type=" . $array[0] . "&subtype=" . $array[1] . "&category=" . $array[2] . "&subcategory=" . $array[3] . "&page=1' class='btn btn-info btn-block'>Добавить учебный материал</a>";
     }
     return $out;
 }
예제 #3
0
파일: teacher.php 프로젝트: Jluct/obuceisea
 static function editWisdom($id, $education)
 {
     $data = R::load('information', $id);
     if ($education) {
         $education = R::load('education', $education);
     }
     $typeData = wisdom::getType($data);
     if (!empty($education)) {
         $aaa = '&education=' . $education->id;
     } else {
         $aaa = '';
     }
     $name = !empty($education) ? $education->name : $data->name;
     $description = !empty($education) ? $education->description : $data->description;
     $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>";
     $out .= "<form method='post' action='?ctrl=teacher&action=WisdomData&category=" . $typeData[0]->id . "&id=" . $id . $aaa . "'>\r\n                <input class='form-control' name='name' placeholder='Имя' value='" . $name . "'>";
     if (empty($education)) {
         $out .= "<textarea class='form-control' name='shortdescription' placeholder='Краткое описание'>" . $data->shortdescription . "</textarea>";
     }
     if (!empty($education)) {
         $out .= "<input type='text' name='number' class=\"form-control\" placeholder='Номер курса' value='" . $education->number . "'>";
     }
     $out .= "<textarea class='form-control' name='description' placeholder='Полное описание'>" . $description . "</textarea>\r\n        </div>\r\n        <div class='col-sm-6'>\r\n            <input type='reset' class='btn alert-danger btn-block'>\r\n        </div>\r\n        <div class='col-sm-6'>\r\n            <input type='submit' class='btn alert-success btn-block'>\r\n            </form>\r\n        </div>\r\n        <script src='../../ckeditor/ckeditor.js'></script>\r\n        <script>\r\n            CKEDITOR.replace('description');\r\n        </script>\r\n        ";
     return $out;
 }
예제 #4
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;
 }