Qoob Portfolio

The open qoob is a php mvc framework created to speed up the process of creating dynamic sites. This is the code running this website!

Qoob Portfolio

qoob/app/projects.php


<?php
/**
 * portfolio projects pages
 *
 * @author 		andrew harrison <andrew@harrison.nu>
 * @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 .= '<header><section><h2><a href="'.$this->domain.'/projects/'.$category['url'].'">'.$category['name'].'</a></h2><h4 class="subtitle">'.$category['excerpt'].'</h4></section></header>';
				$subcategories = $this->qoob->project_model->subcategories($category['gallery_cat_id']);
				if(isset($subcategories[0])) {
					foreach ($subcategories as $subcategory) {
						$list .= '<article><aside><a href="'.$this->domain.'/projects/'.$category['url'].'/'.$subcategory['url'].'"><img src="'.$this->domain.'/ui/img/projects/'.$subcategory['url'].'_icon.png" alt="'.$subcategory['name'].'" /></a></aside><section class="info"><h5><a href="'.$this->domain.'/projects/'.$category['url'].'/'.$subcategory['url'].'">'.$subcategory['name'].'</a></h5><p>'.$subcategory['excerpt'].'</p></section></article>';
					}
				}
			}
		}

		$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 = '<header><section><h2><a href="'.$this->domain.'/projects/'.$category[0]['url'].'">'.$category[0]['name'].'</a></h2><h4 class="subtitle">'.$category[0]['excerpt'].'</h4></section></header>';
		$subcategories = $this->qoob->project_model->subcategories($category[0]['gallery_cat_id']);
		if(isset($subcategories[0])) {
			foreach ($subcategories as $subcategory) {
				$list .= '<article><aside><a href="'.$this->domain.'/projects/'.$category[0]['url'].'/'.$subcategory['url'].'"><img src="'.$this->domain.'/ui/img/projects/'.$subcategory['url'].'_icon.png" alt="'.$subcategory['name'].'" /></a></aside><section class="info"><h5><a href="'.$this->domain.'/projects/'.$category[0]['url'].'/'.$subcategory['url'].'">'.$subcategory['name'].'</a></h5><p>'.$subcategory['excerpt'].'</p></section></article>';
			}
		}

		$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 .= '<li><section class="img"><a href="'.$this->domain.'/ui/img/projects/'.$img['filename'].'"><img src="'.$this->domain.'/ui/img/projects/'.$thumb.'"></a></section><section class="title"><a href="'.$this->domain.'/ui/img/projects/'.$img['filename'].'">'.$img['subtitle'].'</a></section></li>';
		}
		$tags = $this->qoob->project_model->project_tags($info[0]['gallery_cat_id']);
		$tools = '';
		foreach ($tags as $tag) {
			$tools .= '<li>'.$tag['name'].'</li>';
		}

		$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'), 
			)
		);
	}
}

?>

Download

raw zip tar