/** * Get * * @access public * @return Template $template */ public static function get() { if (!isset(self::$template)) { $template = new self(); $template->set_template_directory(dirname(__FILE__) . '/../../templates'); $template->assign('license_number', \Tigron\Ups\Config::$license_number); $template->assign('user_id', \Tigron\Ups\Config::$user_id); $template->assign('password', \Tigron\Ups\Config::$password); self::$template = $template; } return self::$template; }
public static function make($file, $data = array(), $config = array()) { $self = new self($config); $self->file = $file; $self->assign($data); return $self; }
/** * renders a template that displays relationships that have granted a specific permission */ function myrel_permission_grants($params, $type = 'select') { if (!$params['permission']) { return '<strong><code>Permission must be specified in order to use myrel_' . $type . '</code></strong>'; } //end if // instantiate a new smarty object because we don't want to inherit // or override any variables $tpl = new self(); if ($params['user'] instanceof \PSUPerson) { $myuser = $params['user']; } elseif ($params['user']) { $myuser = \PSUPerson::get($params['user']); } elseif ($_SESSION['wp_id']) { $myuser = \PSUPerson::get($_SESSION['wp_id']); } else { $myuser = \PSUPerson::get($_SESSION['pidm']); } //end else if ($params['selected'] instanceof \PSUPerson) { $selected_user = $params['selected']; } elseif ($params['selected']) { $selected_user = \PSUPerson::get($params['selected']); } //end else $myuser->pidm; if ($params['hide_self']) { if (!isset($myuser->pidm)) { $tpl->assign('family_member', true); } else { $tpl->assign('family_member', false); } } $tpl->assign('myuser', $myuser); $tpl->assign('selected', $selected_user); $tpl->assign('type', $type); $tpl->assign('permission', $params['permission']); $tpl->assign('identifier', $params['identifier'] ? $params['identifier'] : 'id'); if ($params['url']) { if (strpos($params['url'], '?') === false) { $tpl->assign('no_url_params', true); } $tpl->assign('url', $params['url']); } //end if //check if we want a question mark added to our identifier if ($params['no_qm']) { $tpl->assign('no_qm', true); } //end question mark check return $tpl->fetch(PSU_BASE_DIR . '/app/core/templates/myrelationships.permission_grants.tpl'); }
/** * Returns new MutableList with filtered values from attribute array * * @param callable $callback * @return MutableMap * @throws \InvalidArgumentException */ public function filter($callback) { if (!is_callable($callback)) { throw new \InvalidArgumentException('Filter is not callable!'); } $attributes = array_filter($this->attributes, $callback); $list = new self(); $list->assign($attributes); return $list; }