Exemple #1
0
 public function items()
 {
     $items = array();
     // Numbers.
     for ($i = 1; $i <= $this->paginate->pages(); $i++) {
         $items[] = array('name' => $i, 'current' => $i === $this->paginate->current_page, 'url' => $this->paginate->url($i));
     }
     return $items;
 }
 public function index()
 {
     //$this->test();
     $user_rec = new Usr_Schm();
     $user_rec->username = $_POST['username'] ? $_POST['username'] : "";
     $user_rec->password = $_POST['password'] ? $_POST['password'] : "";
     $user_rec->alias = $_POST['alias'] ? $_POST['alias'] : "";
     $user_rec->email = $_POST['email'] ? $_POST['email'] : "";
     $usernfo_rec = new Usrnfo_Schm();
     $usernfo_rec->im = $_POST['im'] ? $_POST['im'] : "";
     $usernfo_rec->name = $_POST['name'] ? $_POST['name'] : "";
     $usernfo_rec->url = $_POST['url'] ? $_POST['url'] : "";
     if (strlen($_POST['add'])) {
         $this->add($user_rec);
     }
     if (strlen($_POST['edit'])) {
         $this->edit($_POST['uid'], $user_rec, $usernfo_rec);
     }
     if (Util::isal_num($this->get['delete']) && $this->get['delete'] !== "") {
         $this->delete($this->get['delete']);
         $msg[] = "Record has been deleted with id: {$this->get['delete']}";
     }
     if (isset($this->get['page'])) {
         $offset = ($this->get['page'] - 1) * DISPLAY_NUM;
         if ($this->get['page'] <= 0) {
             $offset = 0;
         }
     } else {
         $offset = 0;
     }
     $records = "";
     foreach ($this->getRecords(DISPLAY_NUM, $offset) as $row) {
         $records .= "<tr>" . "<td>{$row['uid']}</td>" . "<td>{$row['username']}</td>" . "<td>{$row['alias']}</td>" . "<td>{$row['email']}</td>" . "<td>{$row['im']}</td>" . "<td>{$row['name']}</td>" . "<td>{$row['url']}</td>" . "<td><a href=\"/Users/edit/{$row['uid']}\">edit</a></td>" . "<td><a href=\"/Users/delete/{$row['uid']}\">delete</a></td>" . "</tr>\n";
     }
     $rec = null;
     if (Util::isal_num($this->get['edit'])) {
         $rec = $this->getRecord($this->get['edit']);
     }
     $output['content'] = $records;
     $paginate = new Paginate();
     $paginate->filename("/Users")->bond_id("page")->total($this->getRecordCount())->page_num($this->get['page'] - 1)->total_devisor(DISPLAY_NUM)->query_arg_array($this->get)->build();
     $output['paginate'] = array('next' => $paginate->getNext(), 'prev' => $paginate->getPrev(), 'pages' => $paginate->getPages());
     if ($this->get['submit'] == "true") {
         echo "<pre>Submitting\n" . $this->outputText() . "</pre>";
         exit;
     }
     $controller = Util::tpl_content('public/controller', 'users_tpl.php', array('get' => $this->get, 'output' => $output, 'rec' => $rec, 'msg' => $msg));
     $index = Util::tpl_content('public/body', 'index_tpl.php', array('get' => $this->get, 'title' => "Users"));
     echo Util::tpl_body($controller, $index);
     if (SYSDEBUG) {
         echo $this->outputLogHTML();
     }
 }
Exemple #3
0
 public function action_index()
 {
     $photosets = ORM::factory('Photoset')->order_by('order', 'ASC');
     $paginate = Paginate::factory($photosets)->paginate(NULL, NULL, 10)->render();
     $photosets = $photosets->find_all();
     //нумерация с 1 для каждого отдельного фотосета
     /*$photo = ORM::factory('Photosets_Attachment')->order_by('photoset_id')->find_all();
       $i =0;
       $photo_id = array();//массив с id фотосетов
       foreach ($photo as $var)
       {
           if (in_array($var->photoset_id,$photo_id))
               continue;
           else
           {
               $photo_id[$i]=$var->photoset_id;
               $i++;
           }
       }
       foreach ($photo_id as $var)
       {
           $cat = ORM::factory('Photosets_Attachment')->where('photoset_id','=',$var)->find_all();
           $i =1;
           foreach ($cat as $val)
           {
               $val->order = $i;
               $val->save();
               $i++;
           }
       }*/
     $this->set('photosets', $photosets);
     $this->set('paginate', $paginate);
 }
Exemple #4
0
 public function action_index()
 {
     $type = $this->request->param('type');
     $search = Security::xss_clean(Arr::get($_POST, 'search', ''));
     if ($post = $this->request->post()) {
         $title = Security::xss_clean(Arr::get($post, 'title1', ''));
         if ($title != '') {
             $titles = ORM::factory('Specprojecttitle', $type);
             $titles->title = $title;
             $titles->save();
             message::success('Успешно изменено');
             $this->redirect('manage/specprojects/' . $type);
         } else {
             message::error('Поле не может быть пустым.');
             $this->redirect('manage/specprojects/' . $type);
         }
     }
     if (!empty($search)) {
         $this->redirect('manage/specprojects/' . $type . '/search/' . $search);
     }
     $public = ORM::factory('Publication')->join('spec_projects', 'LEFT')->on('publication.id', '=', 'spec_projects.id_publication')->select('publication.*', 'spec_projects.spec_published', 'spec_projects.in_slider', 'spec_projects.in_middle', 'spec_projects.in_bottom')->where('spec_projects.sproject', '=', $type)->order_by('order', 'desc')->order_by('date', 'DESC');
     $paginate = Paginate::factory($public)->paginate(NULL, NULL, 10)->render();
     $public = $public->find_all();
     $title = ORM::factory('Specprojecttitle', $type)->title;
     $this->set('title', $title);
     $this->set('list', $public)->set('type', $type);
     $this->set('paginate', $paginate);
 }
Exemple #5
0
 public function action_index()
 {
     header('Access-Control-Allow-Origin: *');
     $category = (int) $this->request->param('id', 0);
     //SEO. закрываем сортировку
     if ($category != 0) {
         $sort = 1;
         Kotwig_View::set_global('sort', $sort);
     }
     //end_SEO
     $categories = ORM::factory('Photosets_Category')->find_all();
     foreach ($categories as $c) {
         $this->data['categories'][] = array('id' => $c->id, 'name' => $c->name);
     }
     $this->data['category'] = $category;
     $photosets = ORM::factory('Photoset')->where('published', '=', 1)->where('show_' . $this->language, '=', 1)->order_by('order', 'asc');
     if ($category != 0) {
         $photosets = $photosets->where('category_id', '=', $category);
     }
     $photosets = $photosets->order_by('order', 'ASC');
     $paginate = Paginate::factory($photosets)->paginate(NULL, NULL, 12)->page_count();
     $photosets = $photosets->find_all();
     if (count($photosets) < 1) {
         $this->data['error'] = 'Error photo';
     }
     $this->data['pagecount'] = $paginate;
     foreach ($photosets as $p) {
         $img = $p->isCover() ? 'http://' . $_SERVER['HTTP_HOST'] . URL::media('images/w300-h225-ccc-si/' . $p->pathCover()) : 'http://' . $_SERVER['HTTP_HOST'] . URL::media('images/w300-h225-ccc-si/media/images/nocover.jpg');
         $this->data['photosets'][] = array('url' => 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->language . URL::site('api/smartphoto/view/' . $p->id), 'image' => $img, 'name' => $p->name(), 'category' => $p->category->name);
     }
     $this->response->body(json_encode($this->data));
 }
Exemple #6
0
 public function action_questions()
 {
     $list = ORM::factory('Expert_Question')->where('is_answered', '=', 1);
     $search = Security::xss_clean(Arr::get($_POST, 'search', ''));
     if (!empty($search)) {
         $list->and_where('question', 'LIKE', '%' . $search . '%');
     }
     $list = $list->order_by('date', 'DESC');
     $paginate = Paginate::factory($list)->paginate(NULL, NULL, 10)->render();
     $list = $list->find_all();
     $this->set('search', $search);
     $this->set('list', $list);
     $this->set('paginate', $paginate);
     if ($this->request->method() == Request::POST) {
         if (Auth::instance()->logged_in()) {
             try {
                 $user_id = Auth::instance()->get_user()->id;
                 $question = ORM::factory('Expert_Question');
                 $question->user_id = $user_id;
                 $question->question = Arr::get($_POST, 'question', '');
                 $question->date = date('Y-m-d H:i:s');
                 $question->save();
             } catch (ORM_Validation_Exception $e) {
             }
         } else {
             Message::success(i18n::get('You have to login'));
         }
     }
     $this->add_cumb('Question-answer', '/');
 }
Exemple #7
0
 public function action_index()
 {
     if ($this->request->method() == HTTP_Request::POST) {
         try {
             $post = $this->request->post();
             if ($post['action'] == 'delete') {
                 foreach ($post['messages'] as $message) {
                     $message = ORM::factory('Message')->where('id', '=', $message)->where('receiver_id', '=', $this->user->id)->where('sent', '=', 1)->find();
                     if ($message->loaded()) {
                         $message->delete();
                     }
                 }
                 Hint::success('You have deleted the selected messages');
             }
             $this->redirect(Route::url('message.outbox'));
         } catch (ORM_Validation_Exception $e) {
             Hint::error($e->errors('models'));
         }
     }
     $this->view = new View_Message_Outbox();
     // TODO: Add pagination
     $messages = ORM::factory('Message')->where('receiver_id', '=', $this->user->id)->where('sent', '=', 1)->order_by('created', 'DESC');
     $paginate = Paginate::factory($messages)->execute();
     $this->view->pagination = $paginate->render();
     $this->view->messages = $paginate->result();
     $this->view->outbox = 1;
 }
 public function action_index()
 {
     header('Access-Control-Allow-Origin: *');
     $search = Security::xss_clean(isset($_GET['search']) ? $_GET['search'] : '');
     if (!empty($search)) {
         $query_b = '%' . $search . '%';
         $this->searchText = Database::instance()->escape($search);
         $query_a = DB::expr(' AGAINST(' . $this->searchText . ') ');
         $list = ORM::factory('Publication')->distinct('true')->where(DB::expr('MATCH(title_' . $this->language . ')'), '', $query_a)->or_where(DB::expr('MATCH(desc_' . $this->language . ')'), '', $query_a)->or_where(DB::expr('MATCH(text_' . $this->language . ')'), '', $query_a)->or_where('title_' . $this->language, 'like', $query_b)->and_where('published', '=', 1)->limit($this->limit)->offset($this->offset)->find_all();
     } else {
         $list = ORM::factory('Publication')->where('title_' . $this->language, '<>', '')->where('published', '=', 1)->order_by('order', 'DESC');
         $this->data['page_count'] = Paginate::factory($list)->paginate(NULL, NULL, 10)->page_count();
         $list = $list->find_all();
     }
     $pub = array();
     $this->data['search'] = $search;
     foreach ($list as $k => $v) {
         $pub['id'] = $v->id;
         $pub['url'] = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->language . URL::site('api/smartpublications/view/' . $v->id);
         $pub['title'] = $v->title;
         $pub['desc'] = strip_tags($v->desc);
         $pub['image'] = 'http://' . $_SERVER['HTTP_HOST'] . URL::media('/images/w205-h160/' . $v->picture->file_path);
         $this->data['publications'][] = $pub;
     }
     $this->response->body(json_encode($this->data));
 }
Exemple #9
0
 public function action_index()
 {
     header('Access-Control-Allow-Origin: *');
     $id = $this->request->param('id', 0);
     //SEO. закрываем сортировку
     if ($id != 0) {
         $sort = 1;
         Kotwig_View::set_global('sort', $sort);
     }
     //end_SEO
     $category = ORM::factory('Category', $id);
     $video = ORM::factory('Video')->where('published', '=', 1)->and_where('language', '=', $this->language);
     if ($category->loaded()) {
         $video = $video->and_where_open()->and_where('category_id', '=', $id);
         if ($category->has_children()) {
             $video = $video->or_where('category_id', 'IN', $category->children->as_array('id'));
         }
         $video = $video->and_where_close();
     }
     $video = $video->order_by('date', 'DESC');
     $paginate = Paginate::factory($video)->paginate(NULL, NULL, 12)->page_count();
     $video = $video->find_all();
     $cat = ORM::factory('Category')->fulltree;
     foreach ($cat as $c) {
         $this->data['cat'][] = array('id' => $c->id, 'name' => $c->name, 'level' => $c->lvl, 'url' => 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->language . URL::site('api/smartvideo/' . $c->id));
     }
     foreach ($video as $v) {
         $this->data['video'][] = array('id' => $v->id, 'link' => $v->link, 'title' => $v->title, 'description' => $v->description, 'preview' => 'http://img.youtube.com/vi/' . $v->link . '/1.jpg', 'url' => 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->language . URL::site('api/smartvideo/view/' . $v->id), 'category' => $v->category->name);
     }
     $this->data['sel_id'] = $id;
     $this->data['page_count'] = $paginate;
     $this->response->body(json_encode($this->data));
 }
Exemple #10
0
 public function action_delete()
 {
     $id = (int) $this->request->param('id', 0);
     $expert = ORM::factory('Expert_Opinion', $id);
     if (!$expert->loaded()) {
         $this->redirect('manage/expertopinions');
     }
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $loger = new Loger('delete', $expert->title);
         $loger->logThis($expert);
         $expert->delete();
         $list = ORM::factory('Expert_Opinion');
         $paginate = Paginate::factory($list);
         $list = $list->find_all();
         $last_page = $paginate->page_count();
         if ($this->page > $last_page) {
             $this->page = $this->page - 1;
         }
         if ($this->page <= 0) {
             $this->page = 1;
         }
         Message::success(i18n::get('The position of the expert removed'));
         $this->redirect('manage/expertopinions/page-' . $this->page);
     } else {
         $this->set('item', $expert)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/expertopinions/page-' . $this->page));
     }
 }
Exemple #11
0
 public function action_index()
 {
     if ($this->request->method() == HTTP_Request::POST) {
         try {
             if ($this->request->post('active')) {
                 $pet = ORM::factory('User_Pet')->where('user_pet.id', '=', $this->request->post('active'))->where('user_id', '=', $this->user->id)->find();
                 $pet->active = time();
                 $pet->save();
                 Hint::success($pet->name . ' is now your active pet.');
             }
             if ($this->request->post('abandon')) {
                 $pet = ORM::factory('User_Pet')->where('user_pet.id', '=', $this->request->post('abandon'))->where('user_id', '=', $this->user->id)->find();
                 $pet->user_id = NULL;
                 $pet->abandoned = time();
                 $pet->save();
                 Hint::success('You have abandoned ' . $pet->name . '.');
             }
             $this->redirect(Route::get('pets')->uri());
         } catch (ORM_Validation_Exception $e) {
             Hint::error($e->errors('models'));
         }
     }
     $this->view = new View_Pet_Index();
     $pets = ORM::factory('User_Pet')->where('user_id', '=', $this->user->id)->order_by('active', 'desc');
     $paginate = Paginate::factory($pets)->execute();
     $this->view->pagination = $paginate->render();
     $this->view->pets = $paginate->result();
     $this->view->pets_count = count($pets);
     $this->view->href = array('create' => Route::url('pet.create'), 'adopt' => Route::url('pet.adopt'));
 }
Exemple #12
0
 public function action_index()
 {
     $list = ORM::factory('Material')->where('is_journal', '=', 1)->where('is_moderator', '=', 0);
     $sort = Security::xss_clean(Arr::get($_GET, 'sort', 'work'));
     switch ($sort) {
         case "work":
             $list->and_where('status', '=', 2);
             $this->set('sort', 'work');
             break;
         case "accept":
             $list->where('status', '=', 1);
             $this->set('sort', 'accept');
             break;
         case "reject":
             $list->and_where('status', '=', 0);
             $this->set('sort', 'reject');
             break;
         default:
             $this->set('sort', 'all');
     }
     $list->order_by('date', 'DESC');
     $paginate = Paginate::factory($list)->paginate(NULL, NULL, 10)->render();
     $list = $list->find_all();
     $this->set('materials', $list);
     $this->set('paginate', $paginate);
 }
Exemple #13
0
 public function action_index()
 {
     $comments = ORM::factory('Expert_Comment')->order_by('date', 'desc');
     $paginate = Paginate::factory($comments)->set_view('manage/paginate')->paginate()->render();
     $comments = $comments->find_all();
     $this->set('paginate', $paginate)->set('comments', $comments);
 }
Exemple #14
0
 public function action_index()
 {
     $scorms = ORM::factory('Education')->where('language', '=', $this->language)->order_by('number');
     $paginate = Paginate::factory($scorms)->paginate(null, null, 10)->render();
     $scorms = $scorms->find_all();
     $this->set('education', $scorms);
     $this->set('paginate', $paginate);
 }
Exemple #15
0
 public function action_index()
 {
     $thanks = ORM::factory('Thank')->where('published', '=', 1)->order_by('order');
     $paginate = Paginate::factory($thanks)->paginate(NULL, NULL, 10)->render();
     $thanks = $thanks->find_all();
     $this->add_cumb('About project', '/');
     $this->set('thanks', $thanks);
     $this->set('paginate', $paginate);
 }
Exemple #16
0
 public function action_ehistory()
 {
     $list = ORM::factory('Material')->where('status', '=', 1)->and_where('is_journal', '=', 1);
     $list->order_by('date', 'DESC');
     $paginate = Paginate::factory($list)->paginate(NULL, NULL, 10)->render();
     $list = $list->find_all();
     $this->set('materials', $list);
     $this->set('paginate', $paginate);
 }
Exemple #17
0
 public function action_index()
 {
     $links = ORM::factory('Link')->order_by('order');
     $paginate = Paginate::factory($links)->paginate(NULL, NULL, 10)->render();
     $links = $links->find_all();
     $this->add_cumb('Useful links', '/');
     $this->set('links', $links);
     $this->set('paginate', $paginate);
 }
Exemple #18
0
 public function action_index()
 {
     $list = ORM::factory('Publication')->where('title_' . $this->language, '<>', '')->where('published', '=', 1)->order_by('order', 'DESC');
     $paginate = Paginate::factory($list)->paginate(NULL, NULL, 10)->render();
     $list = $list->find_all();
     $this->add_cumb('Publications', '/');
     $this->set('list', $list);
     $this->set('paginate', $paginate);
 }
Exemple #19
0
 public function action_index()
 {
     $infographs = ORM::factory('Infograph')->where('published', '=', 1)->and_where('language', '=', $this->language)->order_by('order', 'asc');
     $paginate = Paginate::factory($infographs)->paginate(NULL, NULL, 10)->render();
     $infographs = $infographs->find_all();
     $this->add_cumb('Infographics', '/');
     $this->set('infographs', $infographs);
     $this->set('paginate', $paginate);
 }
Exemple #20
0
 /**
  * View topics in category.
  */
 public function action_page()
 {
     $topics = $this->category->topics->with('last_post')->with('last_post:user')->order_by('sticky', 'DESC')->order_by('last_post.created', 'DESC');
     $paginate = Paginate::factory($topics)->execute();
     $this->view = new View_Forum_Category_View();
     $this->view->pagination = $paginate->render();
     $this->view->category = $this->category;
     $this->view->topics = $paginate->result();
 }
Exemple #21
0
 public function pagination()
 {
     $this->prev_caption('Anterior');
     $this->next_caption('Próximo ');
     $this->link_separator('/');
     $this->info_navigation = 'de';
     Paginate::$execute = true;
     return $this->paginate(10);
 }
Exemple #22
0
 public function action_index()
 {
     $contacts = ORM::factory('Contact')->where('name_ru', '!=', 'main')->order_by('order', 'ASC')->order_by('id');
     $paginate = Paginate::factory($contacts)->paginate(NULL, NULL, 10)->render();
     $contacts = $contacts->find_all();
     $this->set('contacts', $contacts);
     $this->set('paginate', $paginate);
     $this->set('contacts_main', '1');
 }
Exemple #23
0
 public function action_index()
 {
     $type = (int) Arr::get($_GET, 'type', 0);
     $list = ORM::factory('Comment')->where('status', '=', $type)->order_by('date', 'desc');
     $paginate = Paginate::factory($list)->paginate(NULL, NULL, 10)->render();
     $list = $list->find_all();
     $this->set('type', $type);
     $this->set('list', $list);
     $this->set('paginate', $paginate);
 }
Exemple #24
0
 public function action_list()
 {
     if (!($month = Arr::get($_GET, 'm', 0)) or !($day = Arr::get($_GET, 'd', 0))) {
         throw new HTTP_Exception_404('Page not found');
     }
     $list = ORM::factory('Calendar')->where('day', '=', $day)->and_where('month', '=', $month);
     $paginate = Paginate::factory($list)->paginate(NULL, NULL, 10)->render();
     $list = $list->find_all();
     $this->set('list', $list)->set('day', $day)->set('month', $month);
     $this->set('paginate', $paginate);
 }
Exemple #25
0
 public function action_index()
 {
     $courses = ORM::factory('Education')->where('language', '=', $this->language)->where('published', '=', 1)->order_by('number');
     $paginate = Paginate::factory($courses)->paginate(NULL, NULL, 30)->render();
     $courses = $courses->find_all();
     $this->set('paginate', $paginate);
     $this->set('courses', $courses);
     $this->add_cumb('Цифровые образовательные ресурсы', false);
     /* метатэг description */
     $this->metadata->description(i18n::get('Цифровые образовательные ресурсы, интерактивные материалы, интерактивные тесты'));
 }
Exemple #26
0
 public function action_index()
 {
     $briefings = ORM::factory('Briefing')->where('published', '=', 1)->order_by('date', 'DESC');
     $paginate = Paginate::factory($briefings)->paginate(NULL, NULL, 10)->render();
     $briefings = $briefings->find_all();
     $this->add_cumb('Briefings', '/');
     $this->set('briefings', $briefings);
     $this->set('paginate', $paginate);
     /* метатэг description */
     $this->metadata->description(i18n::get('Брифинги по вопросам изучения истории Казахстана'));
 }
Exemple #27
0
 public function action_list()
 {
     $id = (int) $this->request->param('id', 0);
     if ($id < 0 or $id > 3) {
         throw new HTTP_Exception_404();
     }
     $questions = ORM::factory('Question')->where('status', '=', $id)->order_by('date_question', 'desc');
     $paginate = Paginate::factory($questions)->paginate(NULL, NULL, 10)->render();
     $questions = $questions->find_all();
     $this->set('questions', $questions)->set('paginate', $paginate)->set('status', $id);
 }
Exemple #28
0
 public function action_list()
 {
     header('Access-Control-Allow-Origin: *');
     $id = (int) $this->request->param('id', 0);
     $page = ORM::factory('Page', $id);
     $key_arr = array('publications', 'debate', 'expert', 'organization');
     $e = explode('_', $page->key);
     $paginate = '';
     if (!$page->loaded()) {
         $this->data['error'] = '404';
         $this->response->body(json_encode($this->data));
         return;
     }
     if ($page->static) {
         $this->data['error'] = 'STATIC PAGE';
         $this->response->body(json_encode($this->data));
         return;
     } else {
         //$this->data[''];
         $this->data['page'] = array('id' => $page->id, 'name' => $page->name, 'description' => $page->description);
         $contents = $page->content->where('published', '=', 1)->where('title_' . I18n::$lang, '<>', '')->order_by('date', 'DESC');
         if ($id == 378 || $id == 384 || $id == 385) {
             $paginate = Paginate::factory($contents)->paginate(NULL, NULL, 400)->page_count();
         } else {
             $paginate = Paginate::factory($contents)->paginate(NULL, NULL, 10)->page_count();
         }
         $contents = $contents->find_all();
         if ($page->key == 'message-list' or $page->key == 'articles-list') {
             $c = $page->content->where('published', '=', 1)->order_by('date', 'DESC')->find();
             $cont = array('id' => $c->id, 'page_id' => $c->page_id, 'type' => $c->type, 'title' => $c->title, 'description' => $c->description);
             if ($c->picture->file_path) {
                 $cont['image'] = URL::media('images/w300-h225-ccc-si/' . $c->picture->file_path);
             } else {
                 $cont['image'] = URL::media('images/w300-h225-ccc-si/media/images/nocover.jpg');
             }
             $this->data['last_message'][] = $cont;
         }
         foreach ($contents as $k => $c) {
             $cont = array('id' => $c->id, 'page_id' => $c->page_id, 'type' => $c->type, 'title' => $c->title, 'description' => $c->description, 'url' => 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->language . URL::site('api/smarthistory/view/' . $c->id));
             if ($c->picture->file_path) {
                 $cont['image'] = 'http://' . $_SERVER['HTTP_HOST'] . URL::media('images/w300-h225-ccc-si/' . $c->picture->file_path);
             } else {
                 $cont['image'] = 'http://' . $_SERVER['HTTP_HOST'] . URL::media('images/w300-h225-ccc-si/media/images/nocover.jpg');
             }
             $this->data['contents'][] = $cont;
         }
         $this->data['pagecount'] = $paginate;
     }
     $this->data['pagecount'] = $paginate;
     $cont_p = ORM::factory('Page')->where('parent_id', '=', $id)->find_all();
     $this->data['cont_p'] = $cont_p->as_array();
     $this->response->body(json_encode($this->data));
 }
Exemple #29
0
 public function action_index()
 {
     $search = Security::xss_clean(Arr::get($_POST, 'search', ''));
     if (!empty($search)) {
         $this->redirect('manage/graphs/search/' . $search);
     }
     $graphs = ORM::factory('Graph')->order_by('date', 'DESC');
     $paginate = Paginate::factory($graphs)->paginate(NULL, NULL, 10)->render();
     $graphs = $graphs->order_by('date', 'desc')->find_all();
     $this->set('graphs', $graphs);
     $this->set('paginate', $paginate);
 }
Exemple #30
0
 public function action_index()
 {
     header('Access-Control-Allow-Origin: *');
     $courses = ORM::factory('Education')->where('language', '=', $this->language)->where('published', '=', 1)->order_by('number');
     $paginate = Paginate::factory($courses)->paginate(NULL, NULL, 30)->page_count();
     $courses = $courses->find_all();
     foreach ($courses as $k => $v) {
         $this->data['list'][] = array('id' => $v->id, 'title' => $v->title, 'url' => URL::site('/' . $this->language . '/api/smartscorm/view/' . $v->id, true));
     }
     $this->date['pagecount'] = $paginate;
     $this->response->body(json_encode($this->data));
 }