PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/admin-dashboard/modules/nodes/view_pages.php

https://gitlab.com/diva-lab/essam-labs
PHP | 228 lines | 209 code | 10 blank | 9 comment | 19 complexity | ced18f984f5ac227e7005e0676149239 MD5 | raw file
  1. <?php
  2. require_once("../layout/initialize.php");
  3. //page info
  4. //filter data
  5. $status = null;
  6. $date_from = null;
  7. $date_to = null;
  8. $cat_id = null;
  9. $lang = null;
  10. $inserted_by = null;
  11. //get filter data
  12. if(!empty($_GET["status"])){
  13. $status = $_GET["status"];
  14. }
  15. if(!empty($_GET["inserted_by"])){
  16. $inserted_by = $_GET["inserted_by"];
  17. }
  18. if(!empty($_GET["lang"])){
  19. $lang = $_GET["lang"];
  20. }
  21. if(!empty($_GET["category"])){
  22. $cat_id = $_GET["category"];
  23. }
  24. if(!empty($_GET["from"])){
  25. $date_from =$newDate = date("Y-m-d", strtotime($_GET["from"]));
  26. }
  27. if(!empty($_GET["to"])){
  28. $date_to =$newDate = date("Y-m-d", strtotime($_GET["to"]));
  29. }
  30. //page content class
  31. //page class
  32. $define_class = new Nodes;
  33. $define_class->enable_relation();
  34. $records = $define_class->node_data('page',null,$status,$cat_id,$date_from,$date_to,$general_setting_info->translate_lang_id,$inserted_by,"inserted_date","DESC");
  35. //get all categories
  36. $define_Taxonomies_class= new Taxonomies();
  37. $define_Taxonomies_class->enable_relation();
  38. $categories = $define_Taxonomies_class->taxonomies_data('category',null,null,'inserted_date', 'DESC',null,'many');
  39. require_once("../layout/header.php");
  40. ?>
  41. <!--header end-->
  42. <script src="../../js-crud/nodes.js"></script>
  43. <!--sidebar start-->
  44. <?php require_once("../layout/navigation.php");?>
  45. <!--sidebar end-->
  46. <!--main content start-->
  47. <section id="main-content">
  48. <section class="wrapper site-min-height">
  49. <h4>Nodes Module</h4>
  50. <!-- page start-->
  51. <section class="panel">
  52. <header class="panel-heading"> View Pages</header>
  53. <br/>
  54. <a id="filter" href="#filter_form_page" style="margin-right:15px;"
  55. class="btn btn-default btn-info"> <i class="icon-filter"></i>&nbsp;&nbsp;Filtration</a>
  56. <br />
  57. <br />
  58. <div class="panel-body">
  59. <div class="adv-table editable-table ">
  60. <div class="space15"></div>
  61. <table class="table table-striped table-hover table-bordered" id="editable-sample">
  62. <thead>
  63. <tr>
  64. <th>#</th>
  65. <th style="width:327px;"> Title</th>
  66. <th><i class=""></i> Status</th>
  67. <th><i class=""></i> Categories</th>
  68. <th><i class=""></i> Created Date</th>
  69. <th class=""><i class=""></i> Created by</th>
  70. <th>Action</th>
  71. </tr>
  72. </thead>
  73. <tbody id="myTable">
  74. <?php
  75. $serialize = 1;
  76. foreach($records as $record){
  77. //get content info
  78. $node_contents = $define_class->get_node_content($record->id);
  79. //get post categories
  80. $page_categories_class = new NodesSelectedTaxonomies();
  81. $page_categories_class->enable_relation();
  82. $page_categories = $page_categories_class->return_node_taxonomy($record->id,'page','category','many',$general_setting_info->translate_lang_id);
  83. echo "<tr id='node_{$record->id}'>
  84. <td>{$serialize}</td>
  85. <td><ul>";
  86. foreach($node_contents as $node_content){
  87. echo "<li><a href='full_info.php?id={$node_content->id}'>- {$node_content->title}</a><li>";
  88. }
  89. echo "</ul></td>
  90. <td>{$record->status}</td>
  91. <td>";
  92. foreach($page_categories as $category){
  93. echo "-{$category->taxonomy_name} <br/>";
  94. }
  95. echo "</td>
  96. <td>{$record->inserted_date}</td>
  97. <td>{$record->inserted_by}</td>
  98. <td>";
  99. $module_name = $opened_url_parts[count($opened_url_parts) - 2];
  100. include('../layout/btn_control.php');
  101. //plugin option
  102. $page_model = $define_class->get_model($record->id,'page');
  103. if(!empty($page_model)){
  104. echo "<a href='plugin_option.php?id={$record->id}&model={$page_model->model}' class='btn btn-primary btn-xs tooltips'
  105. data-placement='top' data-toggle='tooltip' data-original-title='Plugin Option' style='margin-left: 3px;' ><i class='icon-cog'></i></a>";
  106. }
  107. echo "</td>
  108. </tr>
  109. <div class='modal fade' id='my{$record->id}' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>
  110. <div class='modal-dialog'>
  111. <div class='modal-content'>
  112. <div class='modal-header'>
  113. <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>
  114. <h4 class='modal-title'>Delete</h4>
  115. </div>
  116. <div class='modal-body'>
  117. <p> Are you sure you want delete $record->title ??</p>
  118. </div>
  119. <div class='modal-footer'>
  120. <input type='hidden' id='task_type' value='delete'>
  121. <button class='btn btn-warning confirm_delete' id='{$record->id}' type='button' data-dismiss='modal' /> Confirm</button>
  122. <button data-dismiss='modal' class='btn btn-default' type='button'>cancel</button>
  123. </div>
  124. </div>
  125. </div>
  126. </div>";
  127. $serialize++;
  128. }?>
  129. </tbody>
  130. </table>
  131. </div>
  132. </div>
  133. </section>
  134. <!-- page end-->
  135. </section>
  136. </section>
  137. <div style="display:none">
  138. <div class="" id="filter_form_page" style=" width:auto; height:500px; ">
  139. <aside class="col-lg-12">
  140. <section>
  141. <div class="panel">
  142. <div class="panel-body">
  143. <form class="form-horizontal tasi-form" role="form" id="form_crud" method="get" action="view.php">
  144. <div class="form-group">
  145. <label class="col-lg-3">Status:</label>
  146. <div class="col-lg-8">
  147. <label class="checkbox-inline">
  148. <input type="radio" name="status" class="radio" value="draft" <?php if(isset($_GET["status"])){
  149. if($status == "draft") echo "checked";} ?>>
  150. Draft</label>
  151. <label class="checkbox-inline">
  152. <input type="radio" name="status" class="radio" value="publish" <?php if(isset($_GET["status"])){
  153. if($status == "publish") echo "checked";} ?>>
  154. Publish</label>
  155. </div>
  156. </div>
  157. <div class="form-group">
  158. <label class="col-lg-3"> Categories:</label>
  159. <div class="col-lg-8" style="max-height: 150px;overflow-y:auto;">
  160. <div class="checkboxes">
  161. <?php foreach($categories as $category){
  162. echo "<label class='label_check'><input type='checkbox' value='{$category->id}' name='category[]'";
  163. if(!empty($_GET["category"])){
  164. if(in_array($category->id, $cat_id)){
  165. echo "checked";
  166. }
  167. }
  168. echo ">{$category->name}</label>";
  169. }?>
  170. </div>
  171. </div>
  172. </div>
  173. <div class="form-group">
  174. <label class=" col-lg-3">Insert Date</label>
  175. <div class="col-lg-8">
  176. <span class="list-group-item-text">&nbsp;&nbsp;<strong>From</strong></span>
  177. <input type="text" class="form-control " name="from" id="start" value="<?php if(isset($_GET["from"])){ echo $date_from;} ?>">
  178. <br>
  179. <br>
  180. <span class="list-group-item-text">&nbsp;&nbsp;<strong>To</strong></span>
  181. <input type="text" class="form-control" name="to" value="<?php if(isset($_GET["from"])){ echo $date_from;} ?>" id="end">
  182. <span class="help-block">Select date range</span> </div>
  183. </div>
  184. <div class="form-group">
  185. <label class="col-lg-2">Created By:</label>
  186. <div class="col-lg-3">
  187. <?php $users = Users::find_all();?>
  188. <select multiple="multiple" class="multi-select s" id="my_multi_select1" name="inserted_by[]">
  189. <?php foreach ($users as $user) : ?>
  190. <?php
  191. if(!empty($inserted_by)){
  192. if(in_array($user->id , $inserted_by)){
  193. echo "<option value={$user->id} selected>{$user->user_name}</option>";
  194. }
  195. }else{
  196. echo "<option value={$user->id} >{$user->user_name}</option>";
  197. }
  198. ?></option>
  199. <?php endforeach;?>
  200. </select>
  201. </div>
  202. </div>
  203. <div class="form-group">
  204. <div class="col-lg-offset-2 col-lg-10">
  205. <button type="submit" class="btn btn-info" id="submit">Execut</button>
  206. <button type="reset" class="btn btn-default" onClick="window.location.href = 'view.php'">Clear</button>
  207. </div>
  208. </div>
  209. </form>
  210. </div>
  211. </div>
  212. </section>
  213. </aside>
  214. </div>
  215. </div>
  216. <!--main content end-->
  217. <!--footer start-->
  218. <?php require_once("../layout/footer.php");?>