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!
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!
<?php
/**
* project model
*
* @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.1
* @package app
* @subpackage model
*/
namespace app\model;
class project_model extends portfolio_model {
/**
* categories
* get a list of available top level categories
*
* @return array
*/
public function categories() {
return $this->query(
"SELECT * FROM `gallery_categories` WHERE `live` = 1 AND `gallery_cat_id` REGEXP '^[0-9]+$' ORDER BY `gallery_cat_id` ASC;",
array()
);
}
/**
* subcategories
* get a list of all subcategories from a parent category id
*
* @param int $id
* @return array
*/
public function subcategories($id) {
$less = intval($id);
$greater = $less++;
return $this->query(
"SELECT * FROM `gallery_categories` WHERE `gallery_cat_id` > :greater AND `gallery_cat_id` < :less ORDER BY `gallery_cat_id` ASC;",
array(
'greater' => $greater,
'less' =>$less
)
);
}
/**
* category
* get category information by url parameter
*
* @param string $url
* @return array
*/
public function category($url) {
return $this->query(
"SELECT * FROM `gallery_categories` WHERE `url` = ':url' LIMIT 1;",
array(
'url' => $url
)
);
}
/**
* project tags
* get all tags for a given project
*
* @param int $id
* @return array
*/
public function project_tags($id) {
return $this->query(
"SELECT t.`name`, t.`url` FROM `gallery_meta` as m INNER JOIN `gallery_tags` as t ON m.`gallery_id` = t.`tag_id` WHERE `meta_val` = :id AND `meta_key` = 'tag' ORDER BY `gallery_id` ASC;",
array(
'id' => $id
)
);
}
/**
* project images
* get all images for a given category
*
* @param int $id
* @return array
*/
public function project_images($id) {
return $this->query(
"SELECT i.`url`, i.`filename`, i.`title`, i.`subtitle`, i.`excerpt`, i.`description` FROM `gallery_meta` as m INNER JOIN `gallery_images` as i ON m.`gallery_id` = i.`image_id` WHERE `meta_val` = :id AND `meta_key` = 'category' AND i.`live` = 1 ORDER BY `gallery_id` ASC;",
array(
'id' => $id
)
);
}
}