Beispiel #1
0
 /**
  * Get a count of all resources
  *
  * @param      integer $gid        Group ID
  * @param      string  $authorized Authorization level
  * @return     integer
  */
 public static function getResourcesCount($gid = NULL, $authorized)
 {
     if (!$gid) {
         return 0;
     }
     $database = App::get('db');
     include_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'tables' . DS . 'resource.php';
     $rr = new \Components\Resources\Tables\Resource($database);
     $database->setQuery("SELECT COUNT(*) FROM " . $rr->getTableName() . " AS r WHERE r.group_owner=" . $database->quote($gid));
     return $database->loadResult();
 }
Beispiel #2
0
 /**
  * Get a list of resource IDs associated with this group
  *
  * @param      string $gid Group alias
  * @return     array
  */
 private function getResourceIDs($gid = NULL)
 {
     if (!$gid) {
         return array();
     }
     $database = App::get('db');
     $rr = new \Components\Resources\Tables\Resource($database);
     $database->setQuery("SELECT id FROM " . $rr->getTableName() . " AS r WHERE r.group_owner=" . $database->quote($gid));
     return $database->loadObjectList();
 }
Beispiel #3
0
 /**
  * Display module content
  *
  * @return  void
  */
 public function display()
 {
     if (User::isGuest()) {
         return false;
     }
     include_once Component::path('com_resources') . DS . 'tables' . DS . 'resource.php';
     include_once Component::path('com_resources') . DS . 'tables' . DS . 'type.php';
     $this->steps = array('Type', 'Compose', 'Attach', 'Authors', 'Tags', 'Review');
     $database = App::get('db');
     $rr = new \Components\Resources\Tables\Resource($database);
     $rt = new \Components\Resources\Tables\Type($database);
     $query = "SELECT r.*, t.type AS typetitle\n\t\t\tFROM " . $rr->getTableName() . " AS r\n\t\t\tLEFT JOIN " . $rt->getTableName() . " AS t ON r.type=t.id\n\t\t\tWHERE r.published=2 AND r.standalone=1 AND r.type!=7 AND r.created_by=" . User::get('id');
     $database->setQuery($query);
     $this->rows = $database->loadObjectList();
     if ($this->rows) {
         include_once Component::path('com_resources') . DS . 'tables' . DS . 'assoc.php';
         include_once Component::path('com_resources') . DS . 'tables' . DS . 'contributor.php';
         include_once Component::path('com_resources') . DS . 'helpers' . DS . 'tags.php';
     }
     require $this->getLayoutPath();
 }