Пример #1
0
 public static function addProjectCondition(&$query, $project_alias = 'p.')
 {
     // we want to deliver all the non-draft projects except for the owner (or colleagues) of these projects
     $myorgs = Organisations::getMyOrganisations();
     if (gettype($query) == 'string') {
         $query .= " AND ({$project_alias}state <> 'draft'" . ($myorgs ? " OR {$project_alias}org_id IN (" . implode($myorgs, ',') . "))" : ")");
     } else {
         if ($myorgs) {
             $query->condition(db_or()->condition("{$project_alias}state", 'draft', '<>')->condition("{$project_alias}org_id", $myorgs, 'IN'));
         } else {
             $query->condition('state', 'draft', '<>');
         }
     }
 }