mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
Admin tools - column selector working everywhere again; improved UI - list/editQuery not needed anymore, queries are auto-generated, table JOIN support added (see comment manager), various improvement, still work in progress
This commit is contained in:
@@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/comment.php,v $
|
||||
| $Revision: 1.11 $
|
||||
| $Date: 2009-11-05 00:11:56 $
|
||||
| $Author: e107coders $
|
||||
| $Revision: 1.12 $
|
||||
| $Date: 2009-11-05 17:32:18 $
|
||||
| $Author: secretr $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
require_once("../class2.php");
|
||||
@@ -54,8 +54,24 @@ class comments_admin_ui extends e_admin_ui
|
||||
{
|
||||
|
||||
protected $pluginTitle = LAN_COMMENTMAN;
|
||||
protected $pluginName = 'comments';
|
||||
protected $pluginName = 'core';
|
||||
protected $table = "comments";
|
||||
|
||||
/**
|
||||
* If present this array will be used to build your list query
|
||||
* You can link fileds from $field array with 'table' parameter, which should equal to a key (table) from this array
|
||||
* 'leftField', 'rightField' and 'fields' attributes here are required, the rest is optional
|
||||
*
|
||||
* @var array [optional]
|
||||
*/
|
||||
protected $tableJoin = array (
|
||||
'user' => array('leftField' => 'comment_author_id', 'rightField' => 'user_id', 'fields' => '*'/*, 'leftTable' => '', 'joinType' => 'LEFT JOIN', 'whereJoin' => '', 'where' => ''*/)
|
||||
);
|
||||
|
||||
//protected $listQry = "SELECT SQL_CALC_FOUND_ROWS * FROM #comments"; // without any Order or Limit.
|
||||
|
||||
protected $editQry = "SELECT * FROM #comments WHERE comment_id = {ID}";
|
||||
|
||||
protected $pid = "comment_id";
|
||||
protected $perPage = 10;
|
||||
protected $batchDelete = true;
|
||||
@@ -65,10 +81,11 @@ class comments_admin_ui extends e_admin_ui
|
||||
'comment_id' => array('title'=> ID, 'type' => 'int', 'width' =>'5%', 'forced'=> TRUE),
|
||||
'comment_item_id' => array('title'=> "item id", 'type' => 'text', 'width' => 'auto'),
|
||||
'comment_subject' => array('title'=> "subject", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first'), // Display name
|
||||
'comment_comment' => array('title'=> "comment", 'type' => 'textarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50'), // Display name
|
||||
'comment_author_id' => array('title'=> "authorID", 'type' => 'text', 'width' => 'auto'), // User name
|
||||
'comment_comment' => array('title'=> "comment", 'type' => 'textarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1'), // Display name
|
||||
'comment_author_id' => array('title'=> "authorID", 'type' => 'number', 'width' => 'auto'), // User id
|
||||
'comment_author_name' => array('title'=> "authorName",'type' => 'text', 'width' => 'auto'), // User name
|
||||
'comment_datestamp' => array('title'=> "datestamp", 'type' => 'datestamp', 'width' => 'auto'), // User name
|
||||
'user_name' => array('title'=> "System user", 'type' => 'text', 'width' => 'auto', 'table' => 'user', 'noedit' => true), // User name
|
||||
'comment_datestamp' => array('title'=> "datestamp", 'type' => 'datestamp', 'width' => 'auto'), // User date
|
||||
'comment_blocked' => array('title'=> "blocked", 'type' => 'text', 'width' => 'auto'), // Photo
|
||||
'comment_ip' => array('title'=> "IP", 'type' => 'text', 'width' => '10%', 'thclass' => 'center' ), // Real name (no real vetting)
|
||||
'comment_type' => array('title'=> "Type", 'type' => 'method', 'width' => '10%', 'thclass' => 'center', 'filter'=>TRUE,'batch'=>TRUE ), // No real vetting
|
||||
@@ -86,10 +103,6 @@ class comments_admin_ui extends e_admin_ui
|
||||
'pref_name' => array('title'=> 'name', 'type' => 'text')
|
||||
);
|
||||
|
||||
protected $listQry = "SELECT * FROM #comments"; // without any Order or Limit.
|
||||
|
||||
protected $editQry = "SELECT * FROM #comments WHERE comment_id = {ID}";
|
||||
|
||||
}
|
||||
|
||||
//TODO Block and Unblock buttons, moderated comments?
|
||||
|
@@ -9,9 +9,9 @@
|
||||
* Custom Menus/Pages Administration
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_admin/cpage.php,v $
|
||||
* $Revision: 1.24 $
|
||||
* $Date: 2009-11-01 23:10:57 $
|
||||
* $Author: e107coders $
|
||||
* $Revision: 1.25 $
|
||||
* $Date: 2009-11-05 17:32:17 $
|
||||
* $Author: secretr $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -111,7 +111,7 @@ class page
|
||||
{
|
||||
|
||||
global $pref,$user_pref, $admin_log;
|
||||
if(isset($_POST['submit-e-columns']))
|
||||
if(isset($_POST['etrigger_ecolumns']))
|
||||
{
|
||||
$user_pref['admin_cpage_columns'] = $_POST['e-columns'];
|
||||
save_prefs('user');
|
||||
|
@@ -9,9 +9,9 @@
|
||||
* Administration Area - Site Links
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_admin/links.php,v $
|
||||
* $Revision: 1.31 $
|
||||
* $Date: 2009-10-26 09:51:56 $
|
||||
* $Author: e107coders $
|
||||
* $Revision: 1.32 $
|
||||
* $Date: 2009-11-05 17:32:17 $
|
||||
* $Author: secretr $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -208,7 +208,7 @@ class links
|
||||
$this->mode = $_GET['mode'];
|
||||
}
|
||||
|
||||
if (varset($_POST['submit-e-columns']))
|
||||
if (varset($_POST['etrigger_ecolumns']))
|
||||
{
|
||||
$user_pref['admin_links_columns'] = $_POST['e-columns'];
|
||||
save_prefs('user');
|
||||
|
@@ -9,8 +9,8 @@
|
||||
* News Administration
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
|
||||
* $Revision: 1.62 $
|
||||
* $Date: 2009-10-30 17:59:32 $
|
||||
* $Revision: 1.63 $
|
||||
* $Date: 2009-11-05 17:32:17 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
require_once("../class2.php");
|
||||
@@ -453,7 +453,7 @@ class admin_newspost
|
||||
$this->_observe_newsCommentsRecalc();
|
||||
}
|
||||
|
||||
if(isset($_POST['submit-e-columns'])) //elseif fails.
|
||||
if(isset($_POST['etrigger_ecolumns'])) //elseif fails.
|
||||
{
|
||||
$this->_observe_saveColumns();
|
||||
}
|
||||
@@ -1143,7 +1143,7 @@ class admin_newspost
|
||||
}
|
||||
|
||||
// AUTO RENDER
|
||||
$text .= $frm->trow($this->fields, $this->fieldpref, $row, 'news_id');
|
||||
$text .= $frm->renderTableRow($this->fields, $this->fieldpref, $row, 'news_id');
|
||||
}
|
||||
|
||||
$text .= "
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $
|
||||
| $Revision: 1.53 $
|
||||
| $Date: 2009-11-04 21:59:35 $
|
||||
| $Revision: 1.54 $
|
||||
| $Date: 2009-11-05 17:32:17 $
|
||||
| $Author: secretr $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -127,7 +127,7 @@ class pluginManager{
|
||||
$this -> pluginProcessUpload();
|
||||
}
|
||||
|
||||
if(isset($_POST['submit-e-columns']))
|
||||
if(isset($_POST['etrigger_ecolumns']))
|
||||
{
|
||||
$user_pref['admin_pluginmanager_columns'] = $_POST['e-columns'];
|
||||
save_prefs('user');
|
||||
|
@@ -9,9 +9,9 @@
|
||||
* Administration Area - User classes
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_admin/userclass2.php,v $
|
||||
* $Revision: 1.31 $
|
||||
* $Date: 2009-11-05 12:26:43 $
|
||||
* $Author: e107coders $
|
||||
* $Revision: 1.32 $
|
||||
* $Date: 2009-11-05 17:32:18 $
|
||||
* $Author: secretr $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -861,7 +861,7 @@ class uclass_manager
|
||||
function uclass_manager()
|
||||
{
|
||||
global $user_pref;
|
||||
if(isset($_POST['submit-e-columns']))
|
||||
if(isset($_POST['etrigger_ecolumns']))
|
||||
{
|
||||
$user_pref['admin_userclass_columns'] = $_POST['e-columns'];
|
||||
save_prefs('user');
|
||||
|
@@ -10,9 +10,9 @@
|
||||
* Administration Area - Users
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_admin/users.php,v $
|
||||
* $Revision: 1.61 $
|
||||
* $Date: 2009-10-21 21:36:10 $
|
||||
* $Author: e107steved $
|
||||
* $Revision: 1.62 $
|
||||
* $Date: 2009-11-05 17:32:17 $
|
||||
* $Author: secretr $
|
||||
*
|
||||
*/
|
||||
require_once ('../class2.php');
|
||||
@@ -762,7 +762,7 @@ class users
|
||||
function usersSaveColumnPref()
|
||||
{
|
||||
global $pref,$user_pref,$admin_log;
|
||||
if (isset ($_POST['submit-e-columns']))
|
||||
if (isset ($_POST['etrigger_ecolumns']))
|
||||
{
|
||||
$user_pref['admin_users_columns'] = $_POST['e-columns'];
|
||||
save_prefs('user');
|
||||
|
@@ -1894,10 +1894,13 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
protected $validationRules = array();
|
||||
protected $prefs = array();
|
||||
protected $pluginName;
|
||||
|
||||
protected $listQry;
|
||||
protected $tableJoin;
|
||||
protected $editQry;
|
||||
protected $table;
|
||||
protected $pid;
|
||||
|
||||
protected $pluginTitle;
|
||||
protected $perPage = 20;
|
||||
protected $batchDelete = true;
|
||||
@@ -2140,10 +2143,11 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$multi_name = vartrue($this->fields['checkboxes']['toggle'], 'multiselect');
|
||||
$selected = $tp->toDB(array_values($this->getPosted($multi_name, array())));
|
||||
$selected = array_values($this->getPosted($multi_name, array()));
|
||||
|
||||
if(empty($selected)) return;
|
||||
|
||||
$selected = array_map('intval', $selected);
|
||||
$trigger = $tp->toDB(explode('__', $batch_trigger));
|
||||
|
||||
$this->triggersEnabled(false); //disable further triggering
|
||||
@@ -2160,26 +2164,38 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
$this->getTreeModel()->setMessages();
|
||||
break;
|
||||
|
||||
case 'bool': // FIXME - tree method update
|
||||
case 'bool':
|
||||
// direct query
|
||||
$field = $trigger[1];
|
||||
$value = $trigger[2];
|
||||
if($cnt = e107::getDb()->db_Update($this->getTableName(), "{$field}={$value} WHERE ".$this->getPrimaryName()." IN (".implode(', ', $selected).")"))
|
||||
$value = $trigger[2] ? 1 : 0;
|
||||
$cnt = $this->getTreeModel()->update($field, $value, $selected, $value, false);
|
||||
if($cnt)
|
||||
{
|
||||
$this->getTreeModel()->addMessageSuccess($cnt.' records successfully updated.', true);
|
||||
$this->getTreeModel()->addMessageSuccess($cnt.' records successfully updated.');
|
||||
}
|
||||
$this->getTreeModel()->setMessages();
|
||||
$this->redirectAction();
|
||||
break;
|
||||
|
||||
case 'boolreverse': // FIXME - tree method update
|
||||
case 'boolreverse':
|
||||
// direct query
|
||||
$field = $trigger[1]; //TODO - errors
|
||||
if($cnt = e107::getDb()->db_Update($this->getTableName(), "{$field}=1-{$field} WHERE ".$this->getPrimaryName()." IN (".implode(', ', $selected).")"))
|
||||
$tree = $this->getTreeModel();
|
||||
$cnt = $tree->update($field, "1-{$field}", $selected, null, false);
|
||||
if($cnt)
|
||||
{
|
||||
e107::getMessage()->add($cnt.' records successfully reversed.', E_MESSAGE_SUCCESS, true);
|
||||
$tree->addMessageSuccess($cnt.' records successfully reversed.');
|
||||
//sync models
|
||||
foreach ($selected as $id)
|
||||
{
|
||||
if($tree->hasNode($id))
|
||||
{
|
||||
$tree->getNode($id)
|
||||
->set($field, $syncvalue)
|
||||
->setMessages();
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->redirectAction();
|
||||
$this->getTreeModel()->setMessages();
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -2191,14 +2207,17 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
}
|
||||
else // default handling
|
||||
{
|
||||
// FIXME - tree method update
|
||||
$field = $trigger[0];
|
||||
$value = $trigger[1]; //TODO - errors
|
||||
if($cnt = e107::getDb()->db_Update($this->getTableName(), "{$field}='{$value}' WHERE ".$this->getPrimaryName()." IN (".implode(', ', $selected).")"))
|
||||
{
|
||||
e107::getMessage()->add('<strong>'.$value.'</strong> set for <strong>'.$cnt.'</strong> records.', E_MESSAGE_SUCCESS, true);
|
||||
|
||||
$cnt = $this->getTreeModel()->update($field, "'".$value."'", $selected, $value, false);
|
||||
if($cnt)
|
||||
{
|
||||
$vttl = $this->getUI()->renderValue($field, $value, $this->getFieldAttr($field));
|
||||
$this->getTreeModel()->addMessageSuccess('<strong>'.$vttl.'</strong> set for <strong>'.$cnt.'</strong> records.');
|
||||
}
|
||||
$this->redirectAction();
|
||||
$this->getTreeModel()->setMessages();
|
||||
//$this->redirectAction();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2274,39 +2293,102 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
$searchQuery = $tp->toDB($request->getQuery('searchquery', ''));
|
||||
list($filterField, $filterValue) = $tp->toDB(explode('__', $request->getQuery('filter_options', '')));
|
||||
|
||||
if($filterField)
|
||||
// TODO - we have var types in current model, use them!
|
||||
if($filterField && $filterValue !== '' && isset($this->fields[$filterField]))
|
||||
{
|
||||
$searchQry[] = $filterField." = '".$filterValue."'";
|
||||
$ftable = vartrue($this->fields[$filterField]['table'], $this->getTableName());
|
||||
$searchQry[] = "`{$ftable}.`$filterField` = '".$filterValue."'";
|
||||
}
|
||||
|
||||
$filter = array();
|
||||
|
||||
foreach($this->fields as $key=>$var)
|
||||
{
|
||||
$ftable = vartrue($var['table'], $this->getTableName());
|
||||
if(($var['type'] == 'text' || $var['type'] == 'method') && $searchQuery)
|
||||
{
|
||||
$filter[] = "(".$key." REGEXP ('".$searchQuery."'))";
|
||||
$filter[] = "(`{$ftable}`.`".$key."` REGEXP ('".$searchQuery."'))";
|
||||
}
|
||||
}
|
||||
if(count($filter)>0)
|
||||
|
||||
//$qry = $this->listQry;
|
||||
// We dont need list qry anymore!
|
||||
$jwhere = array();
|
||||
$joins = array();
|
||||
if($this->tableJoin)
|
||||
{
|
||||
$qry = "SELECT `#".$this->getTableName()."`.*";
|
||||
foreach ($this->tableJoin as $jtable => $tparams)
|
||||
{
|
||||
// Select fields
|
||||
$fields = vartrue($tparams['fields']);
|
||||
if('*' === $fields)
|
||||
{
|
||||
$qry .= ", `#{$jtable}`.*";
|
||||
}
|
||||
else
|
||||
{
|
||||
$fields = array_map('trim', explode(',', $fields));
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
$qry .= ", `#{$jtable}`.`{$field}`";
|
||||
}
|
||||
}
|
||||
// Prepare Joins
|
||||
$joins[] = "
|
||||
".vartrue($tparams['joinType'], 'LEFT JOIN')." `#{$jtable}` ON `#".vartrue($tparams['leftTable'], $this->getTableName())."`.`".vartrue($tparams['leftField'])."` = `#{$jtable}`.`".vartrue($tparams['rightField'])."`".(vartrue($tparams['whereJoin']) ? ' '.$tparams['whereJoin'] : '');
|
||||
|
||||
// Prepare Where
|
||||
if(vartrue($tparams['where']))
|
||||
{
|
||||
$jwhere[] = $tparams['where'];
|
||||
}
|
||||
}
|
||||
|
||||
//From
|
||||
$qry .= " FROM `#".$this->getTableName()."`";
|
||||
|
||||
// Joins
|
||||
if(count($joins) > 0)
|
||||
{
|
||||
$qry .= "\n".implode("\n", $joins);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry = "SELECT `#".$this->getTableName()."`.* FROM `#".$this->getTableName()."`";
|
||||
}
|
||||
|
||||
// join where
|
||||
if(count($jwhere) > 0)
|
||||
{
|
||||
$searchQry[] = " (".implode(" AND ",$jwhere)." )";
|
||||
}
|
||||
// filter where
|
||||
if(count($filter) > 0)
|
||||
{
|
||||
$searchQry[] = " (".implode(" OR ",$filter)." )";
|
||||
}
|
||||
|
||||
$qry = $this->listQry;
|
||||
// where query
|
||||
if(count($searchQry) > 0)
|
||||
{
|
||||
$qry .= " WHERE ".implode(" AND ", $searchQry);
|
||||
}
|
||||
|
||||
|
||||
$qry .= ' ORDER BY '.$tp->toDB($request->getQuery('field', $this->getPrimaryName())).' '.($request->getQuery('asc') == 'desc' ? 'DESC' : 'ASC');
|
||||
$orderField = $request->getQuery('field', $this->getPrimaryName());
|
||||
if(isset($this->fields[$orderField]))
|
||||
{
|
||||
$ftable = vartrue($this->fields[$orderField]['table'], $this->getTableName());
|
||||
// no need of sanitize - it's found in field array
|
||||
$qry .= ' ORDER BY `#'.$ftable.'`.`'.$orderField.'` '.($request->getQuery('asc') == 'desc' ? 'DESC' : 'ASC');
|
||||
}
|
||||
|
||||
if($this->getPerPage())
|
||||
{
|
||||
$from = $request->getQuery('from', 0) < 1 ? 1 : intval($request->getQuery('from'));
|
||||
$startfrom = ($from-1) * intval($this->getPerPage());
|
||||
$qry .= ' LIMIT '.$startfrom.', '.intval($this->getPerPage());
|
||||
$from = intval($request->getQuery('from', 0));
|
||||
//$startfrom = ($from-1) * intval($this->getPerPage());
|
||||
$qry .= ' LIMIT '.$from.', '.intval($this->getPerPage());
|
||||
}
|
||||
return $qry;
|
||||
}
|
||||
|
@@ -9,9 +9,9 @@
|
||||
* Form Handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
|
||||
* $Revision: 1.68 $
|
||||
* $Date: 2009-11-05 12:26:44 $
|
||||
* $Author: e107coders $
|
||||
* $Revision: 1.69 $
|
||||
* $Date: 2009-11-05 17:32:18 $
|
||||
* $Author: secretr $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -848,7 +848,8 @@ class e_form
|
||||
* @param string $pid - eg. table_id
|
||||
* @return
|
||||
*/
|
||||
function trow($fieldarray, $currentlist, $fieldvalues, $pid)
|
||||
|
||||
function renderTableRow($fieldarray, $currentlist, $fieldvalues, $pid)
|
||||
{
|
||||
$cnt = 0;
|
||||
$ret = '';
|
||||
@@ -857,6 +858,8 @@ class e_form
|
||||
$currentlist = $obj->fieldpref;
|
||||
$pid = $obj->pid;*/
|
||||
|
||||
$trclass = vartrue($fieldvalues['__trclass']) ? ' class="'.$trclass.'"' : '';
|
||||
unset($fieldvalues['__trclass']);
|
||||
|
||||
foreach ($fieldarray as $field => $data)
|
||||
{
|
||||
@@ -878,169 +881,8 @@ class e_form
|
||||
}
|
||||
|
||||
$tdclass = vartrue($data['class']);
|
||||
$value = $fieldvalues[$field];
|
||||
$tp = e107::getParser();
|
||||
|
||||
$parms = array();
|
||||
if(isset($data['readParms']))
|
||||
{
|
||||
if(is_string($data['readParms'])) parse_str($data['readParms'], $data['readParms']);
|
||||
$parms = $data['readParms'];
|
||||
}
|
||||
|
||||
switch($field) // special fields
|
||||
{
|
||||
case 'options':
|
||||
if(!$value)
|
||||
{
|
||||
parse_str(str_replace('&', '&', e_QUERY), $query); //FIXME - FIX THIS
|
||||
// keep other vars in tact
|
||||
$query['action'] = 'edit';
|
||||
$query['id'] = $fieldvalues[$pid];
|
||||
|
||||
//$edit_query = array('mode' => varset($query['mode']), 'action' => varset($query['action']), 'id' => $fieldvalues[$pid]);
|
||||
$query = http_build_query($query);
|
||||
|
||||
$value = "<a href='".e_SELF."?{$query}' title='".LAN_EDIT."'><img class='icon action edit' src='".ADMIN_EDIT_ICON_PATH."' alt='".LAN_EDIT."' /></a> ";
|
||||
$value .= $this->submit_image('etrigger_delete['.$fieldvalues[$pid].']', $fieldvalues[$pid], 'delete', LAN_DELETE.' [ ID: '.$fieldvalues[$pid].' ]');
|
||||
}
|
||||
$data['type'] = 'text';
|
||||
break;
|
||||
|
||||
case 'checkboxes':
|
||||
$value = $this->checkbox(vartrue($data['toggle'], 'multiselect').'['.$fieldvalues[$pid].']', $fieldvalues[$pid]);
|
||||
$data['type'] = 'text';
|
||||
$tdclass = $tdclass ? $tdclass.' autocheck e-pointer' : 'autocheck e-pointer';
|
||||
break;
|
||||
}
|
||||
//FIXME - move this block to separate method renderValue(), similar to renderElement()
|
||||
switch($data['type'])
|
||||
{
|
||||
case 'number':
|
||||
if($parms)
|
||||
{
|
||||
if(!isset($parms['sep'])) $value = number_format($number, $parms['decimals']);
|
||||
else $value = number_format($number, $parms['decimals'], vartrue($parms['point'], '.'), vartrue($parms['sep'], ' '));
|
||||
}
|
||||
$value = vartrue($parms['pre']).$value.vartrue($parms['post']);
|
||||
// else same
|
||||
break;
|
||||
|
||||
case 'dropdown':
|
||||
case 'text':
|
||||
if(vartrue($parms['truncate']))
|
||||
{
|
||||
$value = $tp->text_truncate($value, $parms['truncate'], '...');
|
||||
}
|
||||
elseif(vartrue($parms['htmltruncate']))
|
||||
{
|
||||
$value = $tp->html_truncate($value, $parms['htmltruncate'], '...');
|
||||
}
|
||||
$value = vartrue($parms['pre']).$value.vartrue($parms['post']);
|
||||
break;
|
||||
|
||||
case 'bbarea':
|
||||
case 'textarea':
|
||||
$expand = '...';
|
||||
$toexpand = false;
|
||||
if($data['type'] == 'bbarea' && !isset($parms['bb'])) $parms['bb'] = true; //force bb parsing for bbareas
|
||||
$id = trim(str_replace('_', '-', $field));
|
||||
if(!vartrue($parms['noparse'])) $value = $tp->toHTML($value, (vartrue($parms['bb']) ? true : false), vartrue($parms['parse']));
|
||||
if(vartrue($parms['expand']))
|
||||
{
|
||||
$expand = ' <a href="#'.$id.'-expand" class="e-show-if-js e-expandit">'.defset($parms['expand'], $parms['expand'])."</a>";
|
||||
}
|
||||
|
||||
$oldval = $value;
|
||||
if(vartrue($parms['truncate']))
|
||||
{
|
||||
$value = $oldval = strip_tags($value);
|
||||
$value = $tp->text_truncate($value, $parms['truncate'], $expand);
|
||||
$toexpand = $value != $oldval;
|
||||
}
|
||||
elseif(vartrue($parms['htmltruncate']))
|
||||
{
|
||||
$value = $tp->html_truncate($value, $parms['htmltruncate'], $expand);
|
||||
$toexpand = $value != $oldval;
|
||||
}
|
||||
if($toexpand)
|
||||
{
|
||||
// force hide! TODO - core style .expand-c (expand container)
|
||||
$value .= '<div class="expand-c" style="display: none" id="'.$id.'-expand"><div>'.$oldval.'</div></div>';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'icon':
|
||||
$value = '<img src="'.$tp->replaceConstants(vartrue($parms['pre']).$value, 'abs').'" alt="'.basename($value).'" class="icon'.(vartrue($parms['class']) ? ' '.$parms['class'] : '').'" />';
|
||||
break;
|
||||
|
||||
case 'image': //TODO - thumb, js tooltip...
|
||||
$ttl = vartrue($parms['title'], 'LAN_PREVIEW');
|
||||
$value = '<a href="'.$tp->replaceConstants(vartrue($parms['pre']).$value, 'abs').'" title="'.basename($value).'">'.defset($ttl, $ttl).'</a>';
|
||||
break;
|
||||
|
||||
case 'datestamp':
|
||||
$value = e107::getDateConvert()->convert_date($value, vartrue($parms['mask'], 'short'));
|
||||
break;
|
||||
|
||||
case 'userclass':
|
||||
$value = $this->_uc->uc_get_classname($value);
|
||||
break;
|
||||
|
||||
case 'userclasses':
|
||||
$classes = explode(',', $value);
|
||||
$value = array();
|
||||
foreach ($classes as $cid)
|
||||
{
|
||||
$value[] = $this->_uc->uc_get_classname($cid);
|
||||
}
|
||||
$value = implode(vartrue($parms['separator']), $pieces);
|
||||
break;
|
||||
|
||||
case 'user_name':
|
||||
case 'user_loginname':
|
||||
case 'user_login':
|
||||
case 'user_customtitle':
|
||||
case 'user_email':
|
||||
$value = get_user_data($value);
|
||||
if($value)
|
||||
{
|
||||
$value = $value[$data['type']] ? $value[$data['type']] : $value['user_name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$value = 'not found';
|
||||
}
|
||||
if(vartrue($parms['truncate']))
|
||||
{
|
||||
$value = $tp->text_truncate($value, $parms['truncate'], '...');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'boolean':
|
||||
$value = $value ? ADMIN_TRUE_ICON : '';// TODO - ADMIN_FALSE_ICON
|
||||
break;
|
||||
|
||||
case 'url':
|
||||
$ttl = $value;
|
||||
if(vartrue($parms['truncate']))
|
||||
{
|
||||
$ttl = $tp->text_truncate($value, $parms['truncate'], '...');
|
||||
}
|
||||
$value = "<a href='".$tp->replaceConstants(vartrue($parms['pre']).$value, 'abs')."' title='{$value}'>".$ttl."</a>";
|
||||
break;
|
||||
|
||||
case 'method': // Custom Function
|
||||
$method = $field;
|
||||
$value = call_user_func_array(array($this, $method), array($value, 'read', $parms));
|
||||
break;
|
||||
|
||||
//TODO - form_userclass, order,... and maybe more types
|
||||
|
||||
default:
|
||||
continue; //unknown type
|
||||
break;
|
||||
}
|
||||
if($field == 'checkboxes') $tdclass = $tdclass ? $tdclass.' autocheck e-pointer' : 'autocheck e-pointer';
|
||||
$value = $this->renderValue($field, $fieldvalues[$field], $data, $fieldvalues[$pid]);
|
||||
|
||||
if($tdclass)
|
||||
{
|
||||
@@ -1057,7 +899,6 @@ class e_form
|
||||
|
||||
if($cnt)
|
||||
{
|
||||
$trclass = vartrue($fieldvalues['trclass']) ? ' class="'.$trclass.'"' : '';
|
||||
return '
|
||||
<tr'.$trclass.'>
|
||||
'.$ret.'
|
||||
@@ -1068,11 +909,184 @@ class e_form
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render Field Value
|
||||
* @param string $field field name
|
||||
* @param mixed $value field value
|
||||
* @param array $attributes field attributes including render parameters, element options - see e_admin_ui::$fields for required format
|
||||
* @return string
|
||||
*/
|
||||
function renderValue($field, $value, $attributes, $id = 0)
|
||||
{
|
||||
$parms = array();
|
||||
if(isset($attributes['readParms']))
|
||||
{
|
||||
if(is_string($attributes['readParms'])) parse_str($attributes['readParms'], $attributes['readParms']);
|
||||
$parms = $attributes['readParms'];
|
||||
}
|
||||
$tp = e107::getParser();
|
||||
switch($field) // special fields
|
||||
{
|
||||
case 'options':
|
||||
if(!$value)
|
||||
{
|
||||
parse_str(str_replace('&', '&', e_QUERY), $query); //FIXME - FIX THIS
|
||||
// keep other vars in tact
|
||||
$query['action'] = 'edit';
|
||||
$query['id'] = $id;
|
||||
|
||||
//$edit_query = array('mode' => varset($query['mode']), 'action' => varset($query['action']), 'id' => $id);
|
||||
$query = http_build_query($query);
|
||||
|
||||
$value = "<a href='".e_SELF."?{$query}' title='".LAN_EDIT."'><img class='icon action edit' src='".ADMIN_EDIT_ICON_PATH."' alt='".LAN_EDIT."' /></a> ";
|
||||
$value .= $this->submit_image('etrigger_delete['.$id.']', $id, 'delete', LAN_DELETE.' [ ID: '.$id.' ]');
|
||||
}
|
||||
//$attributes['type'] = 'text';
|
||||
return $value;
|
||||
break;
|
||||
|
||||
case 'checkboxes':
|
||||
$value = $this->checkbox(vartrue($attributes['toggle'], 'multiselect').'['.$id.']', $id);
|
||||
//$attributes['type'] = 'text';
|
||||
return $value;
|
||||
break;
|
||||
}
|
||||
|
||||
switch($attributes['type'])
|
||||
{
|
||||
case 'number':
|
||||
if($parms)
|
||||
{
|
||||
if(!isset($parms['sep'])) $value = number_format($number, $parms['decimals']);
|
||||
else $value = number_format($number, $parms['decimals'], vartrue($parms['point'], '.'), vartrue($parms['sep'], ' '));
|
||||
}
|
||||
$value = vartrue($parms['pre']).$value.vartrue($parms['post']);
|
||||
// else same
|
||||
break;
|
||||
|
||||
case 'dropdown':
|
||||
case 'text':
|
||||
if(vartrue($parms['truncate']))
|
||||
{
|
||||
$value = $tp->text_truncate($value, $parms['truncate'], '...');
|
||||
}
|
||||
elseif(vartrue($parms['htmltruncate']))
|
||||
{
|
||||
$value = $tp->html_truncate($value, $parms['htmltruncate'], '...');
|
||||
}
|
||||
$value = vartrue($parms['pre']).$value.vartrue($parms['post']);
|
||||
break;
|
||||
|
||||
case 'bbarea':
|
||||
case 'textarea':
|
||||
$expand = '...';
|
||||
$toexpand = false;
|
||||
if($attributes['type'] == 'bbarea' && !isset($parms['bb'])) $parms['bb'] = true; //force bb parsing for bbareas
|
||||
$elid = trim(str_replace('_', '-', $field)).'-'.$id;
|
||||
if(!vartrue($parms['noparse'])) $value = $tp->toHTML($value, (vartrue($parms['bb']) ? true : false), vartrue($parms['parse']));
|
||||
if(vartrue($parms['expand']))
|
||||
{
|
||||
$expand = ' <a href="#'.$elid.'-expand" class="e-show-if-js e-expandit">'.defset($parms['expand'], $parms['expand'])."</a>";
|
||||
}
|
||||
|
||||
$oldval = $value;
|
||||
if(vartrue($parms['truncate']))
|
||||
{
|
||||
$value = $oldval = strip_tags($value);
|
||||
$value = $tp->text_truncate($value, $parms['truncate'], $expand);
|
||||
$toexpand = $value != $oldval;
|
||||
}
|
||||
elseif(vartrue($parms['htmltruncate']))
|
||||
{
|
||||
$value = $tp->html_truncate($value, $parms['htmltruncate'], $expand);
|
||||
$toexpand = $value != $oldval;
|
||||
}
|
||||
if($toexpand)
|
||||
{
|
||||
// force hide! TODO - core style .expand-c (expand container)
|
||||
$value .= '<div class="expand-c" style="display: none" id="'.$elid.'-expand"><div>'.$oldval.'</div></div>';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'icon':
|
||||
$value = '<img src="'.$tp->replaceConstants(vartrue($parms['pre']).$value, 'abs').'" alt="'.basename($value).'" class="icon'.(vartrue($parms['class']) ? ' '.$parms['class'] : '').'" />';
|
||||
break;
|
||||
|
||||
case 'image': //TODO - thumb, js tooltip...
|
||||
$ttl = vartrue($parms['title'], 'LAN_PREVIEW');
|
||||
$value = '<a href="'.$tp->replaceConstants(vartrue($parms['pre']).$value, 'abs').'" title="'.basename($value).'">'.defset($ttl, $ttl).'</a>';
|
||||
break;
|
||||
|
||||
case 'datestamp':
|
||||
$value = e107::getDateConvert()->convert_date($value, vartrue($parms['mask'], 'short'));
|
||||
break;
|
||||
|
||||
case 'userclass':
|
||||
$value = $this->_uc->uc_get_classname($value);
|
||||
break;
|
||||
|
||||
case 'userclasses':
|
||||
$classes = explode(',', $value);
|
||||
$value = array();
|
||||
foreach ($classes as $cid)
|
||||
{
|
||||
$value[] = $this->_uc->uc_get_classname($cid);
|
||||
}
|
||||
$value = implode(vartrue($parms['separator']), $pieces);
|
||||
break;
|
||||
|
||||
case 'user_name':
|
||||
case 'user_loginname':
|
||||
case 'user_login':
|
||||
case 'user_customtitle':
|
||||
case 'user_email':
|
||||
if(is_numeric($value))
|
||||
{
|
||||
$value = get_user_data($value);
|
||||
if($value)
|
||||
{
|
||||
$value = $value[$attributes['type']] ? $value[$attributes['type']] : $value['user_name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$value = 'not found';
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'boolean':
|
||||
$value = $value ? ADMIN_TRUE_ICON : '';// TODO - ADMIN_FALSE_ICON
|
||||
break;
|
||||
|
||||
case 'url':
|
||||
$ttl = $value;
|
||||
if(vartrue($parms['truncate']))
|
||||
{
|
||||
$ttl = $tp->text_truncate($value, $parms['truncate'], '...');
|
||||
}
|
||||
$value = "<a href='".$tp->replaceConstants(vartrue($parms['pre']).$value, 'abs')."' title='{$value}'>".$ttl."</a>";
|
||||
break;
|
||||
|
||||
case 'method': // Custom Function
|
||||
$method = $field;
|
||||
$value = call_user_func_array(array($this, $method), array($value, 'read', $parms));
|
||||
break;
|
||||
|
||||
//TODO - form_userclass, order,... and maybe more types
|
||||
|
||||
default:
|
||||
//unknown type
|
||||
break;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Auto-render Form Element
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param array $attributes field attributes including render parameters, element options
|
||||
* @param array $attributes field attributes including render parameters, element options - see e_admin_ui::$fields for required format
|
||||
* @return string
|
||||
*/
|
||||
function renderElement($key, $value, $attributes)
|
||||
@@ -1238,7 +1252,7 @@ class e_form
|
||||
{
|
||||
foreach($tree as $model)
|
||||
{
|
||||
$text .= $this->trow($fields, $current_fields, $model->getData(), $options['pid']);
|
||||
$text .= $this->renderTableRow($fields, $current_fields, $model->getData(), $options['pid']);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -9,8 +9,8 @@
|
||||
* e107 Base Model
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
|
||||
* $Revision: 1.31 $
|
||||
* $Date: 2009-11-05 00:38:21 $
|
||||
* $Revision: 1.32 $
|
||||
* $Date: 2009-11-05 17:32:19 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
@@ -1537,11 +1537,11 @@ class e_admin_model extends e_model
|
||||
/**
|
||||
* Move model System messages (if any) to the default eMessage stack
|
||||
*
|
||||
* @param boolean $validation move validation messages as well
|
||||
* @param boolean $session store messages to session
|
||||
* @param boolean $validation move validation messages as well
|
||||
* @return e_admin_model
|
||||
*/
|
||||
public function setMessages($validation = true, $session = false)
|
||||
public function setMessages($session = false, $validation = true)
|
||||
{
|
||||
if($validation)
|
||||
{
|
||||
@@ -1626,7 +1626,7 @@ class e_admin_model extends e_model
|
||||
{
|
||||
if($destroy)
|
||||
{
|
||||
$this->setMessages(true, $session_messages)->destroy();
|
||||
$this->setMessages($session_messages)->destroy();
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
@@ -2081,22 +2081,24 @@ class e_tree_model extends e_model
|
||||
class e_admin_tree_model extends e_tree_model
|
||||
{
|
||||
/**
|
||||
* Delete records
|
||||
* Batch Delete records
|
||||
* @param mixed $ids
|
||||
* @param boolean $destroy [optional] destroy object instance after db delete
|
||||
* @param boolean $session_messages [optional]
|
||||
* @return mixed integer deleted records or false on DB error
|
||||
* @return integer deleted records number or false on DB error
|
||||
*/
|
||||
public function delete($ids, $destroy = true, $session_messages = false)
|
||||
{
|
||||
if(!$ids) return $this;
|
||||
if(is_array($ids))
|
||||
if(!$ids) return 0;
|
||||
if(!is_array($ids))
|
||||
{
|
||||
$ids = implode(',', $ids);
|
||||
$ids = array_map('tirm', explode(',', $ids));
|
||||
}
|
||||
$ids = e107::getParser()->toDB($ids);
|
||||
$ids = array_map('intval', $ids);
|
||||
$idstr = implode(', ', $ids);
|
||||
|
||||
$sql = e107::getDb();
|
||||
$res = $sql->db_Delete($this->getModelTable(), $this->getFieldIdName().' IN ('.$ids.')');
|
||||
$res = $sql->db_Delete($this->getModelTable(), $this->getFieldIdName().' IN ('.$idstr.')');
|
||||
if(!$res)
|
||||
{
|
||||
if($sql->getLastErrorNumber())
|
||||
@@ -2107,16 +2109,11 @@ class e_admin_tree_model extends e_tree_model
|
||||
}
|
||||
elseif($destroy)
|
||||
{
|
||||
if(!is_array($ids))
|
||||
{
|
||||
$ids = explode(',', $ids);
|
||||
}
|
||||
|
||||
foreach ($ids as $id)
|
||||
{
|
||||
if($this->getNode($id))
|
||||
if($this->hasNode($id))
|
||||
{
|
||||
$this->getNode($id)->setMessages(true, $session_messages);
|
||||
$this->getNode($id)->setMessages($session_messages);
|
||||
call_user_func(array($this->getNode(trim($id)), 'destroy')); // first call model destroy method if any
|
||||
$this->setNode($id, null);
|
||||
}
|
||||
@@ -2125,6 +2122,65 @@ class e_admin_tree_model extends e_tree_model
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch update tree records/nodes
|
||||
* @param string $field field name
|
||||
* @param string $value
|
||||
* @param string|array $ids numerical array or string comma separated ids
|
||||
* @param mixed $syncvalue value to be used for model data synchronization (db value could be something like '1-field_name'), null - no sync
|
||||
* @param boolean $sanitize [optional] default true
|
||||
* @param boolean $session_messages [optional] default false
|
||||
* @return integer updated count or false on error
|
||||
*/
|
||||
public function update($field, $value, $ids, $syncvalue = null, $sanitize = true, $session_messages = false)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$sql = e107::getDb();
|
||||
if(empty($ids))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(!is_array($ids))
|
||||
{
|
||||
$ids = array_map('tirm', explode(',', $ids));
|
||||
}
|
||||
|
||||
if($sanitize)
|
||||
{
|
||||
$ids = array_map('intval', $ids);
|
||||
$field = $tp->toDb($field);
|
||||
$value = "'".$tp->toDb($value)."'";
|
||||
}
|
||||
$idstr = implode(', ', $ids);
|
||||
|
||||
$res = $sql->db_Update($this->getModelTable(), "{$field}={$value} WHERE ".$this->getFieldIdName().' IN ('.$idstr.')');
|
||||
if(!$res)
|
||||
{
|
||||
if($sql->getLastErrorNumber())
|
||||
{
|
||||
$this->addMessageError(LAN_UPDATED_FAILED, $session_messages);
|
||||
$this->addMessageDebug('SQL Error #'.$sql->getLastErrorNumber().': '.$sql->getLastErrorText());
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->addMessageInfo(LAN_NO_CHANGE, $session_messages);
|
||||
}
|
||||
}
|
||||
|
||||
if(null === $syncvalue) return $res;
|
||||
|
||||
foreach ($ids as $id)
|
||||
{
|
||||
if($this->hasNode($id))
|
||||
{
|
||||
$this->getNode($id)
|
||||
->set($field, $syncvalue)
|
||||
->setMessages($session_messages);
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -9,8 +9,8 @@
|
||||
* Release Plugin Administration UI
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/release/includes/admin.php,v $
|
||||
* $Revision: 1.5 $
|
||||
* $Date: 2009-11-05 00:28:25 $
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 2009-11-05 17:32:18 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
@@ -59,20 +59,54 @@ class plugin_release_admin_ui extends e_admin_ui
|
||||
// required
|
||||
protected $pluginTitle = "e107 Release";
|
||||
|
||||
// required
|
||||
/**
|
||||
* plugin name or 'core'
|
||||
* IMPORTANT: should be 'core' for non-plugin areas because this
|
||||
* value defines what CONFIG will be used. However, I think this should be changed
|
||||
* very soon (awaiting discussion with Cam)
|
||||
* Maybe we need something like $prefs['core'], $prefs['release'] ... multiple getConfig support?
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $pluginName = 'release';
|
||||
|
||||
// required - if no custom model is set in init()
|
||||
// required
|
||||
protected $table = "release";
|
||||
|
||||
/**
|
||||
* If present this array will be used to build your list query
|
||||
* You can link fileds from $field array with 'table' parameter, which should equal to a key (table) from this array
|
||||
* 'leftField', 'rightField' and 'fields' attributes here are required, the rest is optional
|
||||
*
|
||||
* @var array [optional] table_name => array join parameters
|
||||
*/
|
||||
protected $tableJoin = array(
|
||||
//'user' => array('leftField' => 'user_id', 'rightField' => 'comment_author_id', 'fields' => '*'/*, 'joinType' => 'LEFT JOIN', 'whereJoin' => '', 'where' => ''*/)
|
||||
);
|
||||
|
||||
// required if no custom tree model is set in init()
|
||||
// NOT NEEDED ANYMORE!!!
|
||||
//protected $listQry = "SELECT * FROM #release";
|
||||
// without any Order or Limit.
|
||||
|
||||
// optional - required only in case of e.g. tables JOIN. This also could be done with custom model (set it in init())
|
||||
// NOT NEEDED ANYMORE!!!
|
||||
//protected $editQry = "SELECT * FROM #release WHERE release_id = {ID}";
|
||||
|
||||
// required - if no custom model is set in init() (primary id)
|
||||
protected $pid = "release_id";
|
||||
|
||||
// optional
|
||||
protected $perPage = 20;
|
||||
|
||||
// default - true
|
||||
// default - true - TODO - move to displaySettings
|
||||
protected $batchDelete = true;
|
||||
|
||||
// UNDER CONSTRUCTION
|
||||
protected $displaySettings = array();
|
||||
|
||||
// UNDER CONSTRUCTION
|
||||
protected $disallowPages = array('main/create', 'main/prefs');
|
||||
|
||||
//TODO change the release_url type back to URL before release.
|
||||
// required
|
||||
@@ -85,13 +119,15 @@ class plugin_release_admin_ui extends e_admin_ui
|
||||
*
|
||||
* - type (string) null (means system), number, text, dropdown, url, image, icon, datestamp, userclass, userclasses, user[_name|_loginname|_login|_customtitle|_email],
|
||||
* boolean, method
|
||||
* full/most recent reference list - e_form::trow(), e_form::renderElement(), e_admin_form_ui::renderBatchFilter()
|
||||
* full/most recent reference list - e_form::renderTableRow(), e_form::renderElement(), e_admin_form_ui::renderBatchFilter()
|
||||
*
|
||||
* - data (string) Data type, one of the following: int, integer, string, str, float, bool, boolean, model, null
|
||||
* Used only if $dataFields is not set
|
||||
* full/most recent reference list - e_admin_model::sanitize(), db::_getFieldValue()
|
||||
* - primary (boolean) primary field (obsolete, $pid is now used)
|
||||
*
|
||||
* - table (string) if there and non-empty - value is coming from another table, which SHOULD be found in $tableJoin (see above)
|
||||
*
|
||||
* - help (string) edit/create table - inline help, constant name will be accpeted as well, optional
|
||||
* - note (string) edit/create table - text shown below the field title (left column), constant name will be accpeted as well, optional
|
||||
*
|
||||
@@ -196,12 +232,6 @@ class plugin_release_admin_ui extends e_admin_ui
|
||||
'pref_name' => array('title'=> 'name', 'type' => 'text', 'data' => 'string', 'validate' => 'regex', 'rule' => '#^[\w]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')
|
||||
);
|
||||
|
||||
// required if no custom tree model is set in init()
|
||||
protected $listQry = "SELECT * FROM #release"; // without any Order or Limit.
|
||||
|
||||
// optional - required only in case of e.g. tables JOIN. This also could be done with custom model (set it in init())
|
||||
protected $editQry = "SELECT * FROM #release WHERE release_id = {ID}";
|
||||
|
||||
// optional
|
||||
public function init()
|
||||
{
|
||||
|
Reference in New Issue
Block a user