コード例 #1
0
 /**
  * Return manager instance
  *
  * @access protected
  * @param void
  * @return Templates
  */
 function manager()
 {
     if (!$this->manager instanceof COTemplates) {
         $this->manager = COTemplates::instance();
     }
     return $this->manager;
 }
コード例 #2
0
 function index()
 {
     if (!can_manage_templates(logged_user())) {
         flash_error(lang("no access permissions"));
         ajx_current("empty");
         return;
     }
     $templates = COTemplates::instance()->findAll();
     tpl_assign('templates', $templates);
 }
コード例 #3
0
	/**
	 * Return manager instance
	 *
	 * @access protected
	 * @param void
	 * @return Templates
	 */
	function manager() {
		if(!($this->manager instanceof COTemplates)) $this->manager = COTemplates::instance();
		return $this->manager;
	} // manager
コード例 #4
0
 /**
  * @deprecated
  * @author Ignacio Vazquez - elpepe.uy@gmail.com
  */
 static function _findAllowed()
 {
     //1.  Find members where user can add tasks
     //$sqlMembers = "
     $sql = "\n\t\t\tSELECT distinct(id) AS id\n\t\t\tFROM " . TABLE_PREFIX . "object_members om\n\t\t\tINNER JOIN " . TABLE_PREFIX . "templates t ON t.object_id = om.object_id\n\t\t\tINNER JOIN " . TABLE_PREFIX . "objects o ON om.object_id = o.id\n\t\t\tWHERE\n\t\t\t    member_id IN (  \n\t\t\t    \tSELECT distinct(member_id) \n\t\t\t\t\tFROM " . TABLE_PREFIX . "contact_member_permissions o \n\t\t\t\t\tWHERE object_type_id = " . ProjectTasks::instance()->getObjectTypeId() . " \n\t\t\t\t\tAND permission_group_id IN ( " . ContactPermissionGroups::getPermissionGroupIdsByContactCSV(logged_user()->getId()) . " ) AND can_write= 1 \n\t\t\t\t)\n\t\t\t\tAND is_optimization = 0\n\t\t\tGROUP BY om.object_id\t\t\n\t\t";
     $res = DB::execute($sql);
     $tpls = array();
     // Iterate on the results and make som filtering
     while ($row = $res->fetchRow()) {
         $tpl = COTemplates::instance()->findById($row['id']);
         $tpls[] = $tpl;
     }
     return $tpls;
 }
コード例 #5
0
 /**
  * This function will return paginated result. Result is an array where first element is
  * array of returned object and second populated pagination object that can be used for
  * obtaining and rendering pagination data using various helpers.
  *
  * Items and pagination array vars are indexed with 0 for items and 1 for pagination
  * because you can't use associative indexing with list() construct
  *
  * @access public
  * @param array $arguments Query argumens (@see find()) Limit and offset are ignored!
  * @param integer $items_per_page Number of items per page
  * @param integer $current_page Current page number
  * @return array
  */
 function paginate($arguments = null, $items_per_page = 10, $current_page = 1)
 {
     if (isset($this) && instance_of($this, 'COTemplates')) {
         return parent::paginate($arguments, $items_per_page, $current_page);
     } else {
         return COTemplates::instance()->paginate($arguments, $items_per_page, $current_page);
         //$instance =& COTemplates::instance();
         //return $instance->paginate($arguments, $items_per_page, $current_page);
     }
     // if
 }