Exemple #1
0
    public function getAdminsList()
    {
        global $wpdb;
        $admins = dbGmp::get('SELECT * FROM #__users 
			INNER JOIN #__usermeta ON #__users.ID = #__usermeta.user_id
			WHERE #__usermeta.meta_key = "#__capabilities" AND #__usermeta.meta_value LIKE "%administrator%"');
        return $admins;
    }
Exemple #2
0
 public function save($marker = array(), &$update = false)
 {
     $id = isset($marker['id']) ? (int) $marker['id'] : 0;
     $marker['title'] = isset($marker['title']) ? trim($marker['title']) : '';
     $marker['coord_x'] = isset($marker['coord_x']) ? (double) $marker['coord_x'] : 0;
     $marker['coord_y'] = isset($marker['coord_y']) ? (double) $marker['coord_y'] : 0;
     $update = (bool) $id;
     if (!empty($marker['title'])) {
         if (!isset($marker['marker_group_id'])) {
             $marker['marker_group_id'] = 0;
         }
         if (!isset($marker['icon']) || !frameGmp::_()->getModule('icons')->getModel()->iconExists($marker['icon'])) {
             $marker['icon'] = 1;
         }
         $marker['map_id'] = isset($marker['map_id']) ? (int) $marker['map_id'] : 0;
         if (!$update) {
             $marker['create_date'] = date('Y-m-d H:i:s');
             if ($marker['map_id']) {
                 $maxSortOrder = (int) dbGmp::get('SELECT MAX(sort_order) FROM @__markers WHERE map_id = "' . $marker['map_id'] . '"', 'one');
                 $marker['sort_order'] = ++$maxSortOrder;
             }
         }
         $marker['params'] = isset($marker['params']) ? utilsGmp::serialize($marker['params']) : '';
         if ($update) {
             dispatcherGmp::doAction('beforeMarkerUpdate', $id, $marker);
             $dbRes = frameGmp::_()->getTable('marker')->update($marker, array('id' => $id));
             dispatcherGmp::doAction('afterMarkerUpdate', $id, $marker);
         } else {
             dispatcherGmp::doAction('beforeMarkerInsert', $marker);
             $dbRes = frameGmp::_()->getTable('marker')->insert($marker);
             dispatcherGmp::doAction('afterMarkerInsert', $dbRes, $marker);
         }
         if ($dbRes) {
             if (!$update) {
                 $id = $dbRes;
             }
             return $id;
         } else {
             $this->pushError(frameGmp::_()->getTable('marker')->getErrors());
         }
     } else {
         $this->pushError(__('Please enter marker name'), 'marker_opts[title]', GMP_LANG_CODE);
     }
     return false;
 }
Exemple #3
0
 public function getLastInsertID()
 {
     return dbGmp::get('SELECT MAX(' . $this->_id . ') FROM ' . $this->_table, 'one');
 }
Exemple #4
0
 public function getUserStatsCount()
 {
     $query = 'SELECT COUNT(*) AS total FROM @__usage_stat';
     return (int) dbGmp::get($query, 'one');
 }