* @copyright creative commons attribution-shareAlike 3.0 unported
* @license http://creativecommons.org/licenses/by-sa/3.0/
* @version 0.1.0
*/
namespace app;
class projects extends base {
/**
* index
* list all project categories
*/
function index() {
$this->qoob->load('app\model\project_model');
$categories = $this->qoob->project_model->categories();
$list = '';
if(!isset($categories[0])) {
$list = 'No projects found...';
} else {
foreach ($categories as $category) {
$list .= '';
$subcategories = $this->qoob->project_model->subcategories($category['gallery_cat_id']);
if(isset($subcategories[0])) {
foreach ($subcategories as $subcategory) {
$list .= ''.$subcategory['excerpt'].'
';
}
}
}
}
$this->qoob->load('qoob\core\view\stache');
$content = $this->qoob->stache->render(
'nav',
array(
'domain' => $this->domain,
'projects' => 'class="active"',
),
true
);
$content .= $this->qoob->stache->render(
'projects',
array(
'list' => $list
),
true
);
$this->qoob->stache->render(
'template',
array(
'author' => \library::get('CONFIG.GENERAL.author'),
'copyright' => \library::get('CONFIG.GENERAL.copyrightHTML'),
'keywords' => \library::get('CONFIG.GENERAL.keywords'),
'description' => \library::get('CONFIG.GENERAL.description'),
'domain' => $this->domain,
'title' => 'personal programming portfolio',
'page' => 'projects',
'content' => $content,
'year'=> date('Y'),
)
);
}
/**
* category
* list all projects in a given category
*
* @param array $args url parameters
*/
function category($args) {
$url = isset($args['category']) ? $args['category'] : '';
$this->qoob->load('app\model\project_model');
$category = $this->qoob->project_model->category($url);
if(!isset($category[0])) {
throw new \Exception("Unknown Category", 404);
}
$list = ''.$category[0]['excerpt'].'
';
$subcategories = $this->qoob->project_model->subcategories($category[0]['gallery_cat_id']);
if(isset($subcategories[0])) {
foreach ($subcategories as $subcategory) {
$list .= ''.$subcategory['excerpt'].'
';
}
}
$this->qoob->load('qoob\core\view\stache');
$content = $this->qoob->stache->render(
'nav',
array(
'domain' => $this->domain,
'projects' => 'class="active"',
),
true
);
$content .= $this->qoob->stache->render(
'projects',
array(
'list' => $list
),
true
);
$this->qoob->stache->render(
'template',
array(
'author' => \library::get('CONFIG.GENERAL.author'),
'copyright' => \library::get('CONFIG.GENERAL.copyrightHTML'),
'keywords' => \library::get('CONFIG.GENERAL.keywords'),
'description' => \library::get('CONFIG.GENERAL.description'),
'domain' => $this->domain,
'title' => 'personal programming portfolio',
'page' => 'projects',
'content' => $content,
'year'=> date('Y'),
)
);
}
/**
* overview
* list all images for a given project
*
* @param array $args url parameters
*/
function overview($args) {
$this->qoob->load('app\model\project_model');
//parent category info
$url = isset($args['category']) ? $args['category'] : '';
$category = $this->qoob->project_model->category($url);
if(!isset($category[0])) {
throw new \Exception("Unknown Category", 404);
}
//subcategory info
$title = isset($args['title']) ? $args['title'] : '';
$info = $this->qoob->project_model->category($title);
if(!isset($info[0])) {
throw new \Exception("Unknown Project", 404);
}
$imgs = $this->qoob->project_model->project_images($info[0]['gallery_cat_id']);
$gallery = '';
foreach ($imgs as $img) {
$thumb = str_replace('.', '_thumb.', $img['filename']);
$gallery .= '
';
}
$tags = $this->qoob->project_model->project_tags($info[0]['gallery_cat_id']);
$tools = '';
foreach ($tags as $tag) {
$tools .= ''.$tag['name'].'';
}
$this->qoob->load('qoob\core\view\stache');
$content = $this->qoob->stache->render(
'nav',
array(
'domain' => $this->domain,
'projects' => 'class="active"',
),
true
);
$content .= $this->qoob->stache->render(
'project',
array(
'name' => $info[0]['name'],
'title' => $info[0]['title'],
'description' => $info[0]['description'],
'tools' => $tools,
'gallery' => $gallery,
'banner' => 'style="background: url(\''.$this->domain.'/ui/img/projects/'.$info[0]['url'].'_banner.png\');"'
),
true
);
$this->qoob->stache->render(
'template',
array(
'author' => \library::get('CONFIG.GENERAL.author'),
'copyright' => \library::get('CONFIG.GENERAL.copyrightHTML'),
'keywords' => \library::get('CONFIG.GENERAL.keywords'),
'description' => \library::get('CONFIG.GENERAL.description'),
'domain' => $this->domain,
'title' => 'personal programming portfolio',
'page' => 'projects',
'content' => $content,
'year'=> date('Y'),
)
);
}
}
?>