Guest User

cash

a guest
Feb 15th, 2010
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.88 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * Elgg widget layout
  5.  *
  6.  * @package Elgg
  7.  * @subpackage Core
  8.  * @author Curverider Ltd
  9.  * @link http://elgg.org/
  10.  */
  11.  
  12. $widgettypes = get_widget_types();
  13.  
  14. $owner = page_owner_entity();
  15.  
  16. $area1widgets = get_widgets(page_owner(),get_context(),1);
  17. $area2widgets = get_widgets(page_owner(),get_context(),2);
  18. $area3widgets = get_widgets(page_owner(),get_context(),3);
  19.  
  20. if (empty($area1widgets) && empty($area2widgets) && empty($area3widgets)) {
  21.     if (isset($vars['area3'])) {
  22.         $vars['area1'] = $vars['area3'];
  23.     }
  24.     if (isset($vars['area4'])) {
  25.         $vars['area2'] = $vars['area4'];
  26.     }
  27. }
  28.  
  29. if (is_array($widgettypes) && sizeof($widgettypes) > 0 && $owner && $owner->canEdit()) {
  30.  
  31. ?>
  32.  
  33. <div id="customise_editpanel">
  34.  
  35. <div id="customise_editpanel_rhs">
  36. <h2><?php echo elgg_echo("widgets:gallery"); ?></h2>
  37. <div id="widget_picker_gallery">
  38.  
  39.  
  40. <?php
  41.     foreach($widgettypes as $handler => $widget) {
  42. ?>
  43.  
  44. <table class="draggable_widget" cellspacing="0"><tr><td>
  45.     <h3>
  46.         <?php echo $widget->name; ?>
  47.         <input type="hidden" name="multiple" value="<?php if ((isset($widget->handler)) && (isset($widgettypes[$widget->handler]->multiple))) echo $widgettypes[$widget->handler]->multiple; ?>" />
  48.         <input type="hidden" name="side" value="<?php if ((isset($widget->handler)) && (isset($widgettypes[$widget->handler])) && (is_array($widgettypes[$widget->handler]->positions))) echo in_array('side',$widgettypes[$widget->handler]->positions); ?>" />
  49.         <input type="hidden" name="main" value="<?php if ((isset($widget->handler)) && (isset($widgettypes[$widget->handler])) && (is_array($widgettypes[$widget->handler]->positions))) echo in_array('main',$widgettypes[$widget->handler]->positions); ?>" />
  50.         <input type="hidden" name="handler" value="<?php echo htmlentities($handler, ENT_QUOTES, 'UTF-8'); ?>" />
  51.         <input type="hidden" name="description" value="<?php echo htmlentities($widget->description, ENT_QUOTES, 'UTF-8'); ?>" />
  52.         <input type="hidden" name="guid" value="0" />
  53.     </h3>
  54. </td>
  55. <td width="17px" align="right"></td>
  56. <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14px" height="14px" class="more_info" /></a></td>
  57. <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15px" height="15px" class="drag_handle" /></a></td>
  58. </tr></table>
  59.  
  60. <?php
  61.     }
  62. ?>
  63.  
  64. <br /><!-- bit of space at the bottom of the widget gallery -->
  65.  
  66. </div><!-- /#customise_editpanel_rhs -->
  67. </div><!-- /#widget_picker_gallery -->
  68.  
  69.  
  70. <div class="customise_editpanel_instructions">
  71. <h2><?php echo elgg_echo('widgets:add'); ?></h2>
  72. <?php echo elgg_view('output/longtext', array('value' => elgg_echo('widgets:add:description'))); ?>
  73. </div>
  74.  
  75.  
  76. <div id="customise_page_view">
  77.  
  78. <table cellspacing="0">
  79. <tr>
  80.     <td colspan="2" align="left" valign="top">
  81.  
  82.     <?php
  83.     if(get_context() == "profile"){
  84.     ?>
  85.             <h2 class="profile_box"><?php echo elgg_echo("widgets:profilebox"); ?></h2>
  86.             <div id="profile_box_widgets">
  87.             <p><small><?php echo elgg_echo('widgets:position:fixed'); ?></small></p>
  88.             </div>
  89.     <?php
  90.     }
  91.     ?>
  92.  
  93.     </td>
  94.  
  95.     <td rowspan="2" align="left" valign="top">
  96.         <h2><?php echo elgg_echo("widgets:rightcolumn"); ?></h2>
  97.         <div id="rightcolumn_widgets" <?php if(get_context() == "profile")echo "class=\"long\""; ?>>
  98.         <?php
  99.             $rightcolumn_widgets = "";
  100.             if (is_array($area3widgets) && sizeof($area3widgets) > 0) {
  101.                 foreach($area3widgets as $widget) {
  102.                     if (!empty($rightcolumn_widgets)) {
  103.                         $rightcolumn_widgets .= "::";
  104.                     }
  105.                     $rightcolumn_widgets .= "{$widget->handler}::{$widget->getGUID()}";
  106.         ?>
  107.  
  108.         <table class="draggable_widget" cellspacing="0"><tr><td width="149px">
  109.             <h3>
  110.                 <?php echo $widgettypes[$widget->handler]->name; ?>
  111.                 <input type="hidden" name="handler" value="<?php
  112.                     echo $widget->handler;
  113.                 ?>" />
  114.                 <input type="hidden" name="multiple" value="<?php echo $widgettypes[$widget->handler]->multiple; ?>" />
  115.                 <input type="hidden" name="side" value="<?php echo in_array('side',$widgettypes[$widget->handler]->positions); ?>" />
  116.                 <input type="hidden" name="main" value="<?php echo in_array('main',$widgettypes[$widget->handler]->positions); ?>" />
  117.                 <input type="hidden" name="description" value="<?php echo htmlentities($widgettypes[$widget->handler]->description, ENT_QUOTES, 'UTF-8'); ?>" />
  118.                 <input type="hidden" name="guid" value="<?php echo $widget->getGUID(); ?>" />
  119.             </h3>
  120.         </td>
  121.         <td width="17px" align="right"></td>
  122.         <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14px" height="14px" class="more_info" /></a></td>
  123.         <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15px" height="15px" class="drag_handle" /></a></td>
  124.         </tr></table>
  125.  
  126.         <?php
  127.  
  128.                 }
  129.             }
  130.         ?>
  131.  
  132.         </div>
  133.     </td><!-- /rightcolumn td -->
  134.  
  135. </tr>
  136.  
  137. <tr>
  138.  
  139. <td>
  140. <h2><?php echo elgg_echo("widgets:leftcolumn"); ?></h2>
  141. <div id="leftcolumn_widgets">
  142.  
  143. <?php
  144.     $leftcolumn_widgets = "";
  145.     if (is_array($area1widgets) && sizeof($area1widgets) > 0) {
  146.         foreach($area1widgets as $widget) {
  147.             if (!empty($leftcolumn_widgets)) {
  148.                 $leftcolumn_widgets .= "::";
  149.             }
  150.             $leftcolumn_widgets .= "{$widget->handler}::{$widget->getGUID()}";
  151. ?>
  152.  
  153. <table class="draggable_widget" cellspacing="0"><tr><td width="149px">
  154.     <h3>
  155.         <?php echo $widgettypes[$widget->handler]->name; ?>
  156.         <input type="hidden" name="handler" value="<?php
  157.             echo $widget->handler;
  158.         ?>" />
  159.         <input type="hidden" name="multiple" value="<?php echo $widgettypes[$widget->handler]->multiple; ?>" />
  160.         <input type="hidden" name="side" value="<?php echo in_array('side',$widgettypes[$widget->handler]->positions); ?>" />
  161.         <input type="hidden" name="main" value="<?php echo in_array('main',$widgettypes[$widget->handler]->positions); ?>" />
  162.         <input type="hidden" name="description" value="<?php echo htmlentities($widgettypes[$widget->handler]->description, ENT_QUOTES, 'UTF-8'); ?>" />
  163.         <input type="hidden" name="guid" value="<?php echo $widget->getGUID(); ?>" />
  164.     </h3>
  165. </td>
  166. <td width="17px" align="right"></td>
  167. <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14px" height="14px" class="more_info" /></a></td>
  168. <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15px" height="15px" class="drag_handle" /></a></td>
  169. </tr></table>
  170.  
  171. <?php
  172.  
  173.         }
  174.     }
  175. ?>
  176. </div>
  177. </td>
  178.  
  179. <td>
  180.  
  181. <h2><?php echo elgg_echo("widgets:middlecolumn"); ?></h2>
  182. <div id="middlecolumn_widgets">
  183.  
  184. <?php
  185.     $middlecolumn_widgets = "";
  186.     if (is_array($area2widgets) && sizeof($area2widgets) > 0) {
  187.         foreach($area2widgets as $widget) {
  188.             if (!empty($middlecolumn_widgets)) {
  189.                 $middlecolumn_widgets .= "::";
  190.             }
  191.             $middlecolumn_widgets .= "{$widget->handler}::{$widget->getGUID()}";
  192. ?>
  193.  
  194. <table class="draggable_widget" cellspacing="0"><tr><td width="149px">
  195.     <h3>
  196.         <?php echo $widgettypes[$widget->handler]->name; ?>
  197.         <input type="hidden" name="handler" value="<?php
  198.             echo $widget->handler;
  199.         ?>" />
  200.         <input type="hidden" name="multiple" value="<?php echo $widgettypes[$widget->handler]->multiple; ?>" />
  201.         <input type="hidden" name="side" value="<?php echo in_array('side',$widgettypes[$widget->handler]->positions); ?>" />
  202.         <input type="hidden" name="main" value="<?php echo in_array('main',$widgettypes[$widget->handler]->positions); ?>" />
  203.         <input type="hidden" name="description" value="<?php echo htmlentities($widgettypes[$widget->handler]->description, ENT_QUOTES, 'UTF-8'); ?>" />
  204.         <input type="hidden" name="guid" value="<?php echo $widget->getGUID(); ?>" />
  205.     </h3>
  206. </td>
  207. <td width="17px" align="right"></td>
  208. <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14px" height="14px" class="more_info" /></a></td>
  209. <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15px" height="15px" class="drag_handle" /></a></td>
  210. </tr></table>
  211.  
  212. <?php
  213.  
  214.         }
  215.     }
  216. ?>
  217.  
  218. </div>
  219. </td>
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226. </tr>
  227. </table>
  228.  
  229. </div><!-- /#customise_page_view -->
  230.  
  231. <form action="<?php echo $vars['url']; ?>action/widgets/reorder" method="post">
  232. <textarea type="textarea" value="Left widgets"   style="display:none" name="debugField1" id="debugField1" /><?php echo $leftcolumn_widgets; ?></textarea>
  233. <textarea type="textarea" value="Middle widgets" style="display:none" name="debugField2" id="debugField2" /><?php echo $middlecolumn_widgets; ?></textarea>
  234. <textarea type="textarea" value="Right widgets"  style="display:none" name="debugField3" id="debugField3" /><?php echo $rightcolumn_widgets; ?></textarea>
  235.  
  236. <input type="hidden" name="context" value="<?php echo get_context(); ?>" />
  237. <input type="hidden" name="owner" value="<?php echo page_owner(); ?>" />
  238.  
  239. <?php
  240. $ts = time();
  241. $token = generate_action_token($ts);
  242. ?>
  243. <input type="hidden" name="__elgg_ts" value="<?php echo $ts; ?>" />
  244. <input type="hidden" name="__elgg_token" value="<?php echo $token; ?>" />
  245.  
  246. <input type="submit" value="<?php echo elgg_echo('save'); ?>" class="submit_button" onclick="$('a.toggle_customise_edit_panel').click();" />
  247. <input type="button" value="<?php echo elgg_echo('cancel'); ?>" class="cancel_button" onclick="$('a.toggle_customise_edit_panel').click();" />
  248.  
  249. </form>
  250. </div><!-- /customise_editpanel -->
  251.  
  252. <?php
  253.  
  254.         }
  255.  
  256. ?>
  257.  
  258.  
  259. <table cellspacing="0" id="widget_table">
  260. <tr>
  261.     <td align="left" valign="top" height="1px">
  262.         <!-- profile box or 'dashboard info' notice -->
  263.         <?php if (isset($vars['area1'])) echo $vars['area1']; ?>
  264.     </td>
  265.     <td rowspan="2" align="left" valign="top" height="100%">
  266.     messageboard here
  267.         <!-- widgets middle -->
  268.         <div id="widgets_middle">
  269.  
  270.         <?php if (isset($vars['area2'])) echo $vars['area2']; ?>
  271.         <?php
  272.  
  273.             if (is_array($area2widgets) && sizeof($area2widgets) > 0)
  274.             foreach($area2widgets as $widget) {
  275.                 echo elgg_view_entity($widget);
  276.             }
  277.  
  278.         ?>
  279.         </div><!-- /#widgets_middle -->
  280.     <td>
  281.     <td rowspan="2" align="left" valign="top" height="100%">
  282.         <?php
  283.         if($_SESSION['user']->guid == page_owner()){
  284.         ?>
  285.         <!-- customise page button -->
  286.         <a href="javascript:void(0);" class="toggle_customise_edit_panel"><?php echo(elgg_echo('dashboard:configure')); ?></a>
  287.         <!-- <div style="clear:both;"></div> -->
  288.         <?php
  289.         }
  290.         ?>
  291.  
  292.         <div id="widgets_right">
  293.         <?php
  294.  
  295.             if (is_array($area3widgets) && sizeof($area3widgets) > 0)
  296.             foreach($area3widgets as $widget) {
  297.                 echo elgg_view_entity($widget);
  298.             }
  299.  
  300.         ?>
  301.  
  302.         </div><!-- /#widgets_right -->
  303.     </td>
  304. </tr>
  305. <tr>
  306.     <td align="left" valign="top">
  307.  
  308.         <!-- left widgets -->
  309.         <div id="widgets_left">
  310.  
  311.         <?php
  312.  
  313.             if (is_array($area1widgets) && sizeof($area1widgets) > 0)
  314.             foreach($area1widgets as $widget) {
  315.                 echo elgg_view_entity($widget);
  316.             }
  317.  
  318.         ?>
  319.  
  320.         </div><!-- /#widgets_left -->
  321.  
  322.     </td>
  323.     </tr>
  324. </table>
  325.  
Advertisement
Add Comment
Please, Sign In to add comment