本文整理汇总了PHP中Lib类的典型用法代码示例。如果您正苦于以下问题:PHP Lib类的具体用法?PHP Lib怎么用?PHP Lib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Lib类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output
public function output()
{
$this->load->library('lib');
$lib = new Lib();
$test = $lib->test();
$data['json'] = $test;
$this->load->view('news/output', $data);
}
示例2: view
public function view($viewname, $params)
{
$getpublic = new Lib();
$public = $getpublic->getPublic();
$checkuri = explode('/', $_SERVER['REQUEST_URI']);
$uri = $checkuri[2];
$withparams = $params;
$name = __DIR__ . '/../views/' . $viewname . '.php';
include __DIR__ . '/../views/MainView.php';
}
示例3: main
public function main()
{
$pageview = Lib::view('page');
$pages = $pageview->getPages();
$this->set('pageview', $pageview);
$this->set('pages', $pages);
}
示例4: display
public function display()
{
$this->main();
$body = $this->output();
$vars = array_merge(array('body' => $body, 'viewname' => $this->viewname, 'pagetitle' => $this->pagetitle, 'metakeywords' => $this->metakeywords, 'metadescription' => $this->metadescription, 'canonical' => $this->canonical, 'css' => $this->css, 'js' => $this->js), $this->vars);
echo Lib::output('common/dom', $vars);
}
示例5: main
public function main()
{
$this->meta[] = array('name' => 'google-signin-client_id', 'content' => Config::$googleClientId . '.apps.googleusercontent.com');
$cookie = Lib::cookie();
$identifier = $cookie->get(Lib::hash(Config::$userkey));
$user = Lib::table('user');
$isLoggedIn = !empty($identifier) && $user->load(array('identifier' => $identifier));
$this->set('user', $user);
$this->set('isLoggedIn', $isLoggedIn);
$this->js[] = $isLoggedIn ? 'inbox' : 'login';
if ($isLoggedIn) {
array_shift($this->js);
$id = Req::get('id');
if (empty($id)) {
Lib::redirect('index');
}
$report = Lib::table('report');
if (!$report->load($id)) {
$this->template = 'no-report';
return;
}
$report->init();
$assignees = Lib::model('user')->getProjectAssignees($report->project_id);
$projectTable = Lib::table('project');
$projectTable->load($report->project_id);
$this->set('report', $report);
$this->set('assignees', $assignees);
$this->set('project', $projectTable);
}
}
示例6: arhive
public function arhive()
{
try {
$zip = new Zip();
$res = array();
foreach ($this->params->files as $n) {
$file = BasefileModel::createFromPath($n, false);
if ($file->type == 'folder') {
$this->arhiveRecursive($zip, $file, $file->name);
} else {
$zip->addFile($file->getContent(), Lib::convert($file->name, Cfg::get('charset'), Cfg::get('charsetZip')), $file->ctime());
}
$res[] = $file;
}
$c = count($res);
$name = 'arhive.zip';
if ($c == 1) {
$name = $res[0]->filename() . '.zip';
}
$zip->sendZip($name);
exit;
} catch (Exception $ex) {
Log::exception($ex);
echo gettext('Не возможно получить архив');
}
exit;
}
示例7: execute
public function execute()
{
$api = Lib::api('admin', array('response' => 'return', 'format' => 'php'));
$type = Req::get('type');
if (!is_callable(array($api, $type))) {
return Lib::redirect('error');
}
$result = $api->{$type}();
$options = array('view' => 'admin');
$ref = Req::post('ref');
if (!$result['state']) {
if (!empty($ref)) {
$options['ref'] = $ref;
}
} else {
$segments = explode('/', base64_decode(urldecode($ref)));
$base = array_shift($segments);
$type = array_shift($segments);
$subtype = array_shift($segments);
if (!empty($type)) {
$options['type'] = $type;
}
if (!empty($subtype)) {
$options['subtype'] = $subtype;
}
}
Lib::redirect('admin', $options);
}
示例8: saveAssignees
public function saveAssignees()
{
$keys = array('project', 'setting');
if (!Req::haspost($keys)) {
return $this->fail('Insufficient data.');
}
$identifier = Lib::cookie(Lib::hash(Config::$userkey));
$user = Lib::table('user');
$isLoggedIn = !empty($identifier) && $user->load(array('identifier' => $identifier));
if (!$isLoggedIn || $user->role != USER_ROLE_ADMIN) {
return $this->fail('You are not authorized.');
}
$project = Req::post('project');
$setting = json_decode(Req::post('setting'));
$projectTable = Lib::table('project');
if ($project !== 'all' && $project !== '-1' && !$projectTable->load(array('name' => $project))) {
return $this->fail('No such project.');
}
if ($project !== 'all') {
$projectAssignee = Lib::table('project_assignee');
$projectAssignee->load(array('user_id' => $setting->id, 'project_id' => $projectTable->id));
if ($setting->value) {
$projectAssignee->store();
} else {
$projectAssignee->delete();
}
}
return $this->success();
}
示例9: display
public function display()
{
$this->main();
$body = $this->output();
$vars = array_merge(array('body' => $body, 'css' => $this->css, 'js' => $this->js, 'googlefont' => $this->googlefont, 'meta' => $this->meta), $this->vars);
echo Lib::output('common/html', $vars);
}
示例10: main
public function main()
{
$this->set('backgroundPattern', '1001000110010111011001101100110111110000010101111101111111001011011001100100');
$this->set('hideHeader', true);
$this->set('pagetitle', 'Hello World');
$twitterHelper = Lib::helper('twitter');
$tweet = $twitterHelper->getLatestTweet('jasonkeorey');
$this->set('tweet', $tweet);
$now = new DateTime();
$currentDay = (int) $now->format('j');
$currentMonth = (int) $now->format('n');
$startYear = $endYear = $currentYear = (int) $now->format('Y');
if ($currentMonth < 7 || $currentMonth === 7 && $currentDay < 10) {
$startYear = $currentYear - 1;
} else {
$endYear = $currentYear + 1;
}
$startDate = new DateTime($startYear . '-07-10');
$endDate = new DateTime($endYear . '-07-10');
$totalDays = ($endDate->format('U') - $startDate->format('U')) / (60 * 60 * 24);
$elapsedDays = floor(($now->format('U') - $startDate->format('U')) / (60 * 60 * 24));
$expPercentage = floor($elapsedDays / $totalDays * 100);
$level = $currentYear - 1988;
$this->set('expPercentage', $expPercentage);
$this->set('level', $level);
}
示例11: Instance
static function Instance()
{
if (self::$_instance == NULL) {
self::$_instance = new Lib();
}
return self::$_instance;
}
示例12: __construct
public function __construct()
{
$expired = time() - Lib::GetSetting('sess.gc_maxlifetime');
$users = DBA::Open()->Query("SELECT * FROM " . USERS . " WHERE birthday != 0");
$this->count = $users->NumRows();
$this->users = $users->GetIterator();
$this->i = 1;
}
示例13: __construct
public function __construct($data, $success = true, $message = '', $resultdata = true, $code = true)
{
$this->success = $success;
$this->message = $message;
$this->data = Lib::code($data);
if ($resultdata) {
$this->data = array('success' => $this->success, 'message' => $this->message, 'data' => $this->data);
}
}
示例14: to
public function to($userid)
{
$userTable = Lib::table('user');
$userTable->load($userid);
$table = Lib::table('slackuser');
if ($table->load(array('email' => $userTable->email))) {
$this->channel = '@' . $table->name;
}
}
示例15: main
public function main()
{
$filterProject = Req::get('project');
if (empty($filterProject)) {
$this->template = 'empty-project';
return;
}
$projectTable = Lib::table('project');
if (!$projectTable->load(array('name' => $filterProject))) {
$this->set('name', $filterProject);
$this->template = 'new-project';
return;
}
$this->meta[] = array('name' => 'google-signin-client_id', 'content' => Config::$googleClientId . '.apps.googleusercontent.com');
$cookie = Lib::cookie();
$identifier = $cookie->get(Lib::hash(Config::$userkey));
$user = Lib::table('user');
$isLoggedIn = !empty($identifier) && $user->load(array('identifier' => $identifier));
$this->set('user', $user);
$this->set('filterProject', $filterProject);
$this->set('filterSettingsProject', $filterProject);
$this->set('isLoggedIn', $isLoggedIn);
if (!$isLoggedIn) {
$this->js[] = 'login';
}
if ($isLoggedIn) {
$this->js[] = 'inbox';
$this->js[] = 'settings';
array_shift($this->js);
$userModel = Lib::model('user');
$assignees = $userModel->getProjectAssignees($projectTable->id);
$users = $userModel->getUsers();
$filterState = $cookie->get('filter-state', 'pending');
$filterAssignee = $cookie->get('filter-assignee', empty($assignees[$user->id]) ? 'all' : $user->id);
$filterSort = $cookie->get('filter-sort', 'asc');
$reportModel = Lib::model('report');
$reports = $reportModel->getItems(array('state' => constant('STATE_' . strtoupper($filterState)), 'assignee_id' => $filterAssignee, 'order' => 'date', 'direction' => $filterSort, 'project_id' => $projectTable->id));
$userSettingsTable = Lib::table('user_settings');
if (!$userSettingsTable->load(array('user_id' => $user->id, 'project_id' => $projectTable->id))) {
$userSettingsTable->load(array('user_id' => $user->id, 'project_id' => 0));
}
$userSettings = $userSettingsTable->getData();
if ($userSettings['color'] !== 'cyan' && $userSettings['color'] !== 'custom') {
$this->css[] = 'theme-' . str_replace(' ', '', $userSettings['color']);
}
$categories = Lib::model('category')->getCategories(['projectid' => $projectTable->id]);
$this->set('filterState', $filterState);
$this->set('filterAssignee', $filterAssignee);
$this->set('filterSort', $filterSort);
$this->set('reports', $reports);
$this->set('assignees', $assignees);
$this->set('userSettings', $userSettings);
$this->set('users', $users);
$this->set('projectTable', $projectTable);
$this->set('categories', $categories);
}
}