Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Thu Apr 12 13:26:42 MDT 2012 - Select / Options list stored procedure…

…, and libary functionality using public functions working
  • Loading branch information...
commit f199e7e2871393400a5a1908e8c70326e53ca198 1 parent 5a81ae7
@jas- authored
Showing with 22 additions and 3 deletions.
  1. +16 −2 models/model.libraries.php
  2. +6 −1 views/admin/view.dashboardUsers.php
View
18 models/model.libraries.php
@@ -286,17 +286,31 @@ function _serialize($array)
* @function _genOptionsList
* @abstract Generic method of creating an select/option list from array
*/
- function _genOptionsList($array)
+ public function _genOptionsList($array, $i)
{
$l = false;
if ((is_array($array)) && (count($array) > 0)) {
foreach($array as $key => $value) {
- $l .= '<option id="" value="">'.$value.'</option>';
+ $l .= '<option id="" value="'.$value[$i].'">'.$value[$i].'</option>';
}
}
return $l;
}
+ /**
+ * @function __sql2Array
+ * @abstract Generates sql from args and returns results as associative array
+ */
+ public function __sql2Array($sql, $conn)
+ {
+ try {
+ $r = $conn->query($sql, true);
+ } catch(Exception $e){
+ // error handler
+ }
+ return (($r) && (is_array($r))) ? $r : false;
+ }
+
public function __clone() {
trigger_error('Cloning prohibited', E_USER_ERROR);
}
View
7 views/admin/view.dashboardUsers.php
@@ -77,6 +77,7 @@ public static function instance($configuration)
private function _main()
{
$geo = $this->registry->libs->parsegeo($this->registry->libs->geolocation($this->registry->libs->_getRealIPv4()));
+
$this->__main();
$this->_menu($geo);
$this->_location($geo);
@@ -112,10 +113,14 @@ private function _footer()
*/
private function __main($geo)
{
+ $level = $this->registry->libs->_genOptionsList($this->registry->libs->__sql2Array('CALL Levels_GetList()', $this->registry->db), 'level');
+ $group = $this->registry->libs->_genOptionsList($this->registry->libs->__sql2Array('CALL Groups_GetList()', $this->registry->db), 'group');
+
$this->registry->tpl->assign('localityName', $geo['localityName'], null, null, null);
$this->registry->tpl->assign('stateOrProvinceName', $geo['stateOrProvinceName'], null, null, null);
$this->registry->tpl->assign('countryName', $geo['countryName'], null, null, null);
- // assign option lists for group & access level
+ $this->registry->tpl->assign('level', $level, null, null, null);
+ $this->registry->tpl->assign('group', $group, null, null, null);
$this->registry->tpl->assign('main', $this->registry->tpl->assign(null, null, 'dashboard.users.tpl', true, $this->registry->libs->_getRealIPv4()), null, null);
}
Please sign in to comment.
Something went wrong with that request. Please try again.