|
From: <vl...@us...> - 2008-10-02 18:02:15
|
Revision: 401
http://acmcontester.svn.sourceforge.net/acmcontester/?rev=401&view=rev
Author: vladykx
Date: 2008-10-02 18:02:05 +0000 (Thu, 02 Oct 2008)
Log Message:
-----------
Renamed to standart as other View Helpers
Added Paths:
-----------
website/library/Ostacium/View/Helper/ListTable.php
Removed Paths:
-------------
website/library/Ostacium/View/Helper/listTable.php
Copied: website/library/Ostacium/View/Helper/ListTable.php (from rev 400, website/library/Ostacium/View/Helper/listTable.php)
===================================================================
--- website/library/Ostacium/View/Helper/ListTable.php (rev 0)
+++ website/library/Ostacium/View/Helper/ListTable.php 2008-10-02 18:02:05 UTC (rev 401)
@@ -0,0 +1,145 @@
+<?php
+
+class Ostacium_View_Helper_listTable extends Zend_View_Helper_FormElement
+{
+ protected static $defaultAttribs;
+ protected $primarykey;
+ protected $defaultURL;
+
+ public function __construct()
+ {
+ $params = Zend_Controller_Front::getInstance()->getRequest()->getParams();
+
+ $this->defaultURL = array_intersect_key($params, array('controller' => 1, 'module' => 1));
+ }
+
+ public function listTable($primarykey, $rows, $headers = null, $actions, $topactions = null, $sortedby = null, $attribs = null)
+ {
+ if (!$attribs)
+ {
+ $attribs = self::$defaultAttribs;
+ }
+
+ $this->primarykey = $primarykey;
+
+ $html = '';
+
+ if ($topactions != null && is_array($topactions))
+ {
+ $html .= '<div class="crudtopaction">';
+
+ foreach ($topactions as $key => $title)
+ {
+ $html .= '<a href="' . $this->view->url($this->defaultURL + array('action' => $key), null, true) . '">' . $title . '</a>';
+ }
+
+ $html .= '</div>';
+ }
+
+ $html .= '<form method="post" onsubmit="return sureMessage(\'' . $this->view->translate('sureMessageAll') . '\');" action="' . $this->view->url($this->defaultURL + array('action' => 'delete'), null, true) . '" id="crudlistform">';
+
+ $html .= '<table';
+
+ if ($attribs != null) $html .= $this->_htmlAttribs($attribs);
+
+ $html .= '>' . "\n";
+
+ if ($headers != null && is_array($headers))
+ {
+ $html .= '<tr>' . "\n";
+
+ if ($actions != null && is_array($actions))
+ {
+ $html .= '<th>' . $this->view->formCheckbox('selectall', 'all', array('onclick' => 'toggleCheck(this.checked);')) . '</th>';
+ }
+
+ foreach ($headers as $key => $options)
+ {
+ $urlparams = array('sort' => $key, 'type' => (isset($sortedby[$key]) && $sortedby[$key] == 'ASC' ? 'DESC' : 'ASC') );
+
+ $html .= '<th>' .(isset($options['sort']) && $options['sort'] ? '<a href="' . $this->view->url($urlparams + $this->defaultURL, null, true) . '">' . $options['label'] . '</a>' : $options['label']) . '</th>' . "\n";
+ }
+
+ if ($actions != null && is_array($actions))
+ {
+ foreach ($actions as $key => $title)
+ {
+ $html .= '<th>' . $title . '</th>' . "\n";
+ }
+ }
+
+ $html .= '</tr>' . "\n";
+ }
+
+ $html .= '<tr>' . "\n";
+
+ foreach($rows as $row) {
+ $html .= '<tr>' . "\n";
+
+ if ($actions != null && is_array($actions))
+ {
+ $html .= '<td align="center">' . $this->view->formCheckbox('cruditems[' . $row[$this->primarykey] . ']', $row[$this->primarykey]) . '</td>';
+ }
+
+ foreach($headers as $key => $options)
+ {
+ if (isset($options['convert']))
+ {
+ $html .= '<td'.(isset($options['align']) ? ' align="' . $options['align'] . '"' : '' ).(isset($options['class']) ? ' class="' . $options['class'] . '"' : '' ).'>' . $this->convert($row[$this->primarykey], $row[$key], $options) . '</td>' . "\n";
+ }
+ else
+ {
+ $html .= '<td'.(isset($options['align']) ? ' align="' . $options['align'] . '"' : '' ).(isset($options['class']) ? ' class="' . $options['class'] . '"' : '' ).'>' . $row[$key] . '</td>' . "\n";
+ }
+ }
+
+ if ($actions != null && is_array($actions))
+ {
+ foreach ($actions as $key => $title)
+ {
+ $alert = '';
+
+ if ($key == 'delete')
+ {
+ $alert = ' onclick="return sureMessage(\'' . $this->view->translate('sureMessage', ($this->primarykey . ': ' . $row[$this->primarykey])) . '\');"';
+ }
+
+ $html .= '<td class="actions"><a'.($alert ? $alert : '').' href="' . $this->view->url(array($this->primarykey => $row[$this->primarykey]) + $this->defaultURL + array('action' => $key), null, true) . '">' . $title . '</a></td>' . "\n";
+ }
+ }
+
+ $html .= '</tr>' . "\n";
+ }
+
+ if ($actions != null && is_array($actions))
+ {
+ $html .= '<tr><td align="center" colspan="'.(count($actions + $headers) + 1).'">' . $this->view->formSubmit('delete', 'Стерти Вибрані') . '</td></tr>';
+ }
+
+ $html .= '</table>' . "\n";
+
+ $html .= '</form>';
+
+ return $html;
+ }
+
+ public function setDefaultAttribs($attribs)
+ {
+ self::$defaultAttribs = $attribs;
+ }
+
+ public function convert($id, $value, $options)
+ {
+ switch ($options['convert'])
+ {
+ case 'order':
+ return '<a href="'.$this->view->url(array('action' => 'up', 'id' => $id)).'">Вверх</a> (' . $value . ') <a href="'.$this->view->url(array('action' => 'down', 'id' => $id)).'">Вниз</a>';
+ break;
+ default:
+ return $value;
+ break;
+ }
+ }
+}
+
+?>
\ No newline at end of file
Deleted: website/library/Ostacium/View/Helper/listTable.php
===================================================================
--- website/library/Ostacium/View/Helper/listTable.php 2008-10-01 09:58:09 UTC (rev 400)
+++ website/library/Ostacium/View/Helper/listTable.php 2008-10-02 18:02:05 UTC (rev 401)
@@ -1,145 +0,0 @@
-<?php
-
-class Ostacium_View_Helper_listTable extends Zend_View_Helper_FormElement
-{
- protected static $defaultAttribs;
- protected $primarykey;
- protected $defaultURL;
-
- public function __construct()
- {
- $params = Zend_Controller_Front::getInstance()->getRequest()->getParams();
-
- $this->defaultURL = array_intersect_key($params, array('controller' => 1, 'module' => 1));
- }
-
- public function listTable($primarykey, $rows, $headers = null, $actions, $topactions = null, $sortedby = null, $attribs = null)
- {
- if (!$attribs)
- {
- $attribs = self::$defaultAttribs;
- }
-
- $this->primarykey = $primarykey;
-
- $html = '';
-
- if ($topactions != null && is_array($topactions))
- {
- $html .= '<div class="crudtopaction">';
-
- foreach ($topactions as $key => $title)
- {
- $html .= '<a href="' . $this->view->url($this->defaultURL + array('action' => $key), null, true) . '">' . $title . '</a>';
- }
-
- $html .= '</div>';
- }
-
- $html .= '<form method="post" onsubmit="return sureMessage(\'' . $this->view->translate('sureMessageAll') . '\');" action="' . $this->view->url($this->defaultURL + array('action' => 'delete'), null, true) . '" id="crudlistform">';
-
- $html .= '<table';
-
- if ($attribs != null) $html .= $this->_htmlAttribs($attribs);
-
- $html .= '>' . "\n";
-
- if ($headers != null && is_array($headers))
- {
- $html .= '<tr>' . "\n";
-
- if ($actions != null && is_array($actions))
- {
- $html .= '<th>' . $this->view->formCheckbox('selectall', 'all', array('onclick' => 'toggleCheck(this.checked);')) . '</th>';
- }
-
- foreach ($headers as $key => $options)
- {
- $urlparams = array('sort' => $key, 'type' => (isset($sortedby[$key]) && $sortedby[$key] == 'ASC' ? 'DESC' : 'ASC') );
-
- $html .= '<th>' .(isset($options['sort']) && $options['sort'] ? '<a href="' . $this->view->url($urlparams + $this->defaultURL, null, true) . '">' . $options['label'] . '</a>' : $options['label']) . '</th>' . "\n";
- }
-
- if ($actions != null && is_array($actions))
- {
- foreach ($actions as $key => $title)
- {
- $html .= '<th>' . $title . '</th>' . "\n";
- }
- }
-
- $html .= '</tr>' . "\n";
- }
-
- $html .= '<tr>' . "\n";
-
- foreach($rows as $row) {
- $html .= '<tr>' . "\n";
-
- if ($actions != null && is_array($actions))
- {
- $html .= '<td align="center">' . $this->view->formCheckbox('cruditems[' . $row[$this->primarykey] . ']', $row[$this->primarykey]) . '</td>';
- }
-
- foreach($headers as $key => $options)
- {
- if (isset($options['convert']))
- {
- $html .= '<td'.(isset($options['align']) ? ' align="' . $options['align'] . '"' : '' ).(isset($options['class']) ? ' class="' . $options['class'] . '"' : '' ).'>' . $this->convert($row[$this->primarykey], $row[$key], $options) . '</td>' . "\n";
- }
- else
- {
- $html .= '<td'.(isset($options['align']) ? ' align="' . $options['align'] . '"' : '' ).(isset($options['class']) ? ' class="' . $options['class'] . '"' : '' ).'>' . $row[$key] . '</td>' . "\n";
- }
- }
-
- if ($actions != null && is_array($actions))
- {
- foreach ($actions as $key => $title)
- {
- $alert = '';
-
- if ($key == 'delete')
- {
- $alert = ' onclick="return sureMessage(\'' . $this->view->translate('sureMessage', ($this->primarykey . ': ' . $row[$this->primarykey])) . '\');"';
- }
-
- $html .= '<td class="actions"><a'.($alert ? $alert : '').' href="' . $this->view->url(array($this->primarykey => $row[$this->primarykey]) + $this->defaultURL + array('action' => $key), null, true) . '">' . $title . '</a></td>' . "\n";
- }
- }
-
- $html .= '</tr>' . "\n";
- }
-
- if ($actions != null && is_array($actions))
- {
- $html .= '<tr><td align="center" colspan="'.(count($actions + $headers) + 1).'">' . $this->view->formSubmit('delete', 'Стерти Вибрані') . '</td></tr>';
- }
-
- $html .= '</table>' . "\n";
-
- $html .= '</form>';
-
- return $html;
- }
-
- public function setDefaultAttribs($attribs)
- {
- self::$defaultAttribs = $attribs;
- }
-
- public function convert($id, $value, $options)
- {
- switch ($options['convert'])
- {
- case 'order':
- return '<a href="'.$this->view->url(array('action' => 'up', 'id' => $id)).'">Вверх</a> (' . $value . ') <a href="'.$this->view->url(array('action' => 'down', 'id' => $id)).'">Вниз</a>';
- break;
- default:
- return $value;
- break;
- }
- }
-}
-
-?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|