PageRenderTime 46ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

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

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