Example #1
0
 /**
  * Display a list of attachments
  *
  * @param      integer $id Resource ID
  * @return     void
  */
 public function displayTask($id = null)
 {
     $this->view->setLayout('display');
     // Incoming
     if (!$id) {
         $id = Request::getInt('rid', 0);
     }
     // Ensure we have an ID to work with
     if (!$id) {
         App::abort(500, Lang::txt('COM_TOOLS_CONTRIBUTE_NO_ID'));
         return;
     }
     $this->view->id = $id;
     $this->view->allowupload = Request::getInt('allowupload', 1);
     $this->view->resource = new \Components\Resources\Tables\Resource($this->database);
     $this->view->resource->load($id);
     // Initiate a resource helper class
     $helper = new \Components\Resources\Helpers\Helper($id, $this->database);
     $helper->getChildren();
     // get config
     $this->view->cparams = Component::params('com_resources');
     $this->view->path = '';
     $this->view->children = $helper->children;
     // Set errors to view
     foreach ($this->getErrors() as $error) {
         $this->setError($error);
     }
     // Output HTML
     $this->view->display();
 }
Example #2
0
    ?>
						</p>
						<?php 
} else {
    $ccount = count($this->model->children('standalone'));
    if ($ccount > 0) {
        echo \Components\Resources\Helpers\Html::primary_child($this->option, $this->model->resource, '', '');
    }
    $video = 0;
    $audio = 0;
    $notes = 0;
    $children = $this->model->children('standalone');
    if (!empty($children)) {
        foreach ($children as $child) {
            $rhelper = new \Components\Resources\Helpers\Helper($child->id, $this->database);
            $rhelper->getChildren();
            if ($rhelper->children && count($rhelper->children) > 0) {
                foreach ($rhelper->children as $grandchild) {
                    switch (\Components\Resources\Helpers\Html::getFileExtension($grandchild->path)) {
                        case 'm4v':
                        case 'mp4':
                        case 'wmv':
                        case 'mov':
                        case 'qt':
                        case 'mpg':
                        case 'mpeg':
                        case 'mpe':
                        case 'mp2':
                        case 'mpv2':
                            $videos++;
                            break;
Example #3
0
$rr->load($this->resid);
//get the parent resource
$rh = new \Components\Resources\Helpers\Helper($this->resid, $this->database);
$rh->getParents();
$parent = $rh->parents[0];
//check to see if parent type is series
$rt = new \Components\Resources\Tables\Type($this->database);
$rt->load($parent->type);
//if we have a series get children
if ($rt->type == "Series" || $rt->type == "Courses") {
    $rh->getChildren($parent->id, 0, 'yes');
    $children = $rh->children;
    //remove any children without a HUBpresenter
    foreach ($children as $k => $c) {
        $rh = new \Components\Resources\Helpers\Helper($c->id, $this->database);
        $rh->getChildren();
        $sub_child = $rh->children;
        $hasHUBpresenter = false;
        foreach ($sub_child as $sc) {
            $rt = new \Components\Resources\Tables\Type($this->database);
            $rt->load($sc->type);
            if (strtolower($rt->type) == "hubpresenter") {
                $hasHUBpresenter = true;
            }
        }
        if (!$hasHUBpresenter) {
            unset($children[$k]);
        }
    }
} else {
    $children = NULL;