Skip to content

Instantly share code, notes, and snippets.

@eggsurplus
Created October 2, 2012 05:14
Show Gist options
  • Select an option

  • Save eggsurplus/3816301 to your computer and use it in GitHub Desktop.

Select an option

Save eggsurplus/3816301 to your computer and use it in GitHub Desktop.
A custom util function
//custom/Extension/application/Ext/Utils/getProjectTemplates.php
function getProjectTemplates(){
static $projectTemplates = null;
if(!$projectTemplates){
global $db;
$query = "SELECT id, name FROM project where deleted = 0 and is_template = 1 order by name asc ";
$result = $db->query($query, false);
$projectTemplates = array();
$projectTemplates[''] = '';
while (($row = $db->fetchByAssoc($result)) != null) {
$projectTemplates[$row['id']] = $row['name'];
}
}
return $projectTemplates;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment