Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.55 KB | None | 0 0
  1. <td class="content">
  2. <?php
  3. global $Router, $Controller;
  4. //
  5. //
  6. //$this->display('/block/breadcrumbs');
  7. // Get route alias to run specific presentation logic.
  8. $alias = $Router->get_path_alias();
  9.  
  10. function acc_get_submenu_def()
  11. {
  12.   global $Router;
  13.   // Each entry in the submenu definition holds its item name and flag
  14.   // showing whether the item is active.
  15.   $def = array(
  16.     $Router::ALIAS_ACCOUNT_PROFILE => array('Profile', false, '/my/account'),
  17.     $Router::ALIAS_ACCOUNT_SETTINGS => array('Settings', false, '/my/account/settings'),
  18.     $Router::ALIAS_ACCOUNT_STAT => array('Statistics', false, '/my/account/stat'),
  19.   );
  20.   return array('submenu' => $def);
  21. }
  22. //
  23. //
  24. ${$Router::ALIAS_ACCOUNT_PROFILE} = function()
  25. {
  26.   global $View, $Router;
  27.   //var_dump($acc_get_submenu_def);
  28.   $submenu = acc_get_submenu_def();
  29.   $submenu['submenu'][$Router::ALIAS_ACCOUNT_PROFILE][1] = true;
  30.   $View->display('/block/nav_submenu', $submenu);
  31.   $View->display('/page/account/profile');
  32. };
  33. //
  34. //
  35. ${$Router::ALIAS_ACCOUNT_STAT} = function()
  36. {
  37.   global $View, $acc_get_submenu_def;
  38.   $submenu = $acc_get_submenu_def();
  39.   $submenu['submenu'][$Router::ALIAS_ACCOUNT_STAT][1] = true;
  40.   $View->display('/block/nav_submenu', $submenu);
  41.   $View->display('/page/account/stat');
  42. };
  43. //
  44. // View user text collection.
  45. ${$Router::ALIAS_VIEW_COLL} = function()
  46. {
  47.   global $View;
  48.   $View->display('/page/coll');
  49. };
  50. //
  51. // Login form.
  52. ${$Router::ALIAS_LOGIN} = function()
  53. {
  54.   global $View;
  55.   $View->display('/login');
  56. };
  57. //
  58. //
  59. ${$Router::ALIAS_REGISTER} = function()
  60. {
  61.   global $View;
  62.   $View->display('/page/register');
  63. };
  64. //
  65. //
  66. ${$Router::ALIAS_EDIT_TEXT} = function()
  67. {
  68.   global $View;
  69.   $View->display('/page/text/edit');
  70. };
  71. //
  72. //
  73. ${$Router::ALIAS_NEW_TEXT} = function()
  74. {
  75.   global $View, $App;
  76.   if ($View->assert('err_forbidden')) { // User cannot add a new text.
  77.     $View->display('/block/message', array('content' => 'f'));
  78.     return;
  79.   }
  80.   $View->display('/page/text/edit');
  81. };
  82. //
  83. // Preview text.
  84. ${$Router::ALIAS_PREVIEW_TEXT} = function()
  85. {
  86.   global $View;
  87.   $View->display('/page/text/preview');
  88. };
  89. //
  90. ${$Router::ALIAS_USER_TEXT} = function()
  91. {
  92.   global $Router, $Controller, $View;
  93.   $user = $Controller->user;
  94.   $text = $Controller->text;
  95.   $view->set('title', $text->get_title());
  96.   $view->set('text', $text->get_tokenized_text());
  97.   //$is_marked_up = true;//$text->is_marked_up();
  98.   //if ($is_marked_up) {
  99.   //  $view->set('csv_word_id', join(',', $text->get_markers()));
  100.   //}
  101.  
  102.   //$view->set('not_in_coll', $user_id ? !$text->is_in_coll($user_id) : true);
  103.  
  104.   $view->set('is_marked_up', $text->is_marked_up());
  105.  
  106. };
  107. //
  108. //
  109. ${$Router::ALIAS_ABOUT_ME} = function()
  110. {
  111.   global $View;
  112.   $View->display('/about_me');
  113. };
  114. //
  115. //
  116. ${$Router::ALIAS_ABOUT_PROJ} = function()
  117. {
  118.   global $View;
  119.   $View->display('/page/about_proj');
  120. };
  121. //
  122. //
  123. ${$Router::ALIAS_READ_TEXT} = function()
  124. {
  125.   global $View, $Router, $Controller;
  126.   $text = $Controller->get('text');
  127.   $user = $Controller->user;
  128.   if (!$text) {
  129.     $View->display('/block/message', array('text' => 'We are sorry, it seems that the text has been removed or does not exists'));
  130.     return;
  131.   }
  132.   $View->display('/page/text/read');
  133. };
  134. //
  135. //
  136. ${$Router::ALIAS_USER_SETTINGS_MARKER} = function()
  137. {
  138.   global $View;
  139.   $View->display('/my/settings/marker');
  140. };
  141. //
  142. // User word cloud.
  143. ${$Router::ALIAS_WORD_CLOUD} = function()
  144. {
  145.   global $View;
  146.   $View->display('/page/cloud');
  147. };
  148.  
  149. if (!empty($$alias) && is_callable($$alias)) {
  150.   $$alias();
  151. }
  152.  
  153. ?>
  154. </td>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement