first import
[projectpier.git] / application / models / project_messages / ProjectMessages.class.php
blobe92db8437b30e3cabfacef5c59fe16a1ff86f664
1 <?php
3 /**
4 * ProjectMessages, generated on Sat, 04 Mar 2006 12:21:44 +0100 by
5 * DataObject generation tool
7 * @http://www.projectpier.org/
8 */
9 class ProjectMessages extends BaseProjectMessages {
11 /**
12 * Return messages that belong to specific project
14 * @param Project $project
15 * @param boolean $include_private Include private messages in the result
16 * @return array
18 static function getProjectMessages(Project $project, $include_private = false) {
19 if($include_private) {
20 $conditions = array('`project_id` = ?', $project->getId());
21 } else {
22 $conditions = array('`project_id` = ? AND `is_private` = ?', $project->getId(), false);
23 } // if
25 return self::findAll(array(
26 'conditions' => $conditions,
27 'order' => '`created_on` DESC',
28 )); // findAll
29 } // getProjectMessages
31 /**
32 * Return project messages that are marked as important for specific project
34 * @param Project $project
35 * @param boolean $include_private Include private messages
36 * @return array
38 static function getImportantProjectMessages(Project $project, $include_private = false) {
39 if($include_private) {
40 $conditions = array('`project_id` = ? AND `is_important` = ?', $project->getId(), true);
41 } else {
42 $conditions = array('`project_id` = ? AND `is_important` = ? AND `is_private` = ?', $project->getId(), true, false);
43 } // if
45 return self::findAll(array(
46 'conditions' => $conditions,
47 'order' => '`created_on` DESC',
48 )); // findAll
49 } // getImportantProjectMessages
51 } // ProjectMessages