public function createModuleMenu($method) { if (!isset($this->lang->my->{$method}->menu)) { return false; } $string = "<nav id='menu'><ul class='nav'>\n"; /* Get menus of current module and current method. */ $moduleMenus = $this->lang->my->{$method}->menu; $currentMethod = $this->app->getMethodName(); /* Cycling to print every menus of current module. */ foreach ($moduleMenus as $methodName => $methodMenu) { /* Split the methodMenu to label, module, method, vars. */ list($label, $module, $method, $vars) = explode('|', $methodMenu); $class = ''; if ($method == $currentMethod) { $class = "class='active'"; } $hasPriv = commonModel::hasPriv($module, $method); if ($module == 'my' and $method == 'order') { $hasPriv = commonModel::hasPriv('order', 'browse'); } if ($module == 'my' and $method == 'contract') { $hasPriv = commonModel::hasPriv('contract', 'browse'); } if ($hasPriv) { $string .= "<li {$class}>" . html::a(helper::createLink($module, $method, $vars), $label) . "</li>\n"; } } $string .= "</ul></nav>\n"; return $string; }
/** * Get block list. * * @access public * @return string */ public function getAvailableBlocks() { foreach ($this->lang->block->availableBlocks as $key => $block) { if (!commonModel::hasPriv($key, 'browse')) { unset($this->lang->block->availableBlocks->{$key}); } } return json_encode($this->lang->block->availableBlocks); }
/** * Get block list. * * @access public * @return string */ public function getAvailableBlocks() { foreach ($this->lang->block->availableBlocks as $key => $block) { $module = $key == 'thread' ? 'forum' : $key; $method = $key == 'thread' ? 'board' : 'index'; if (!commonModel::hasPriv($module, $method)) { unset($this->lang->block->availableBlocks->{$key}); } } return json_encode($this->lang->block->availableBlocks); }
/** * Get block list. * * @access public * @return string */ public function getAvailableBlocks() { foreach ($this->lang->block->availableBlocks as $key => $block) { $method = $key == 'project' ? 'index' : 'browse'; if ($key == 'attend') { $method = 'personal'; } if (!commonModel::hasPriv($key, $method)) { unset($this->lang->block->availableBlocks->{$key}); } } return json_encode($this->lang->block->availableBlocks); }
echo $lang->user->ip; ?> </th> <th><?php echo $lang->user->status; ?> </th> <th><?php echo $lang->actions; ?> </th> </tr> </thead> <tbody> <?php $forbidPriv = commonModel::hasPriv('user', 'forbid'); ?> <?php foreach ($users as $user) { ?> <tr class='text-center'> <td> <input type='checkbox' name='account[]' value='<?php echo $user->account; ?> '/> <?php echo $user->id; ?> </td> <td><?php
/** * contract list. * * @param string $type * @param string $orderBy * @param int $recTotal * @param int $recPerPage * @param int $pageID * @access public * @return void */ public function contract($type = 'unfinished', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $this->loadModel('common', 'sys'); if (!commonModel::hasPriv('order', 'browse')) { $this->common->deny('my', 'order'); } $this->loadModel('contract', 'crm'); $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); $contracts = $this->contract->getList(0, $type, $owner = 'my', $orderBy, $pager); /* Set preAndNext condition. */ $this->session->set('contractQueryCondition', $this->dao->get()); /* Save session for return link. */ $this->session->set('contractList', "javascript:\$.openEntry(\"dashboard\")"); $this->view->title = $this->lang->contract->browse; $this->view->contracts = $contracts; $this->view->customers = $this->loadModel('customer', 'crm')->getPairs('client'); $this->view->pager = $pager; $this->view->type = $type; $this->view->orderBy = $orderBy; $this->view->currencySign = $this->loadModel('common', 'sys')->getCurrencySign(); $this->view->currencyList = $this->common->getCurrencyList(); $this->display(); }
* @license ZPL (http://zpl.pub/page/zplv12.html) * @author Yidong Wang <*****@*****.**> * @package purchase * @version $Id$ * @link http://www.ranzhico.com */ include '../../common/view/header.html.php'; js::set('mode', $mode); ?> <li id='bysearchTab'><?php echo html::a('#', "<i class='icon-search icon'></i>" . $lang->search->common); ?> </li> <div id='menuActions'> <?php if (commonModel::hasPriv('purchase', 'export')) { ?> <div class='btn-group'> <button data-toggle='dropdown' class='btn btn-primary dropdown-toggle' type='button'><?php $lang->exportIcon . $lang->export; ?> <span class='caret'></span></button> <ul id='exportActionMenu' class='dropdown-menu'> <li><?php commonModel::printLink('purchase', 'export', "mode=all&orderBy={$orderBy}", $lang->exportAll, "class='iframe' data-width='700'"); ?> </li> <li><?php commonModel::printLink('purchase', 'export', "mode=thisPage&orderBy={$orderBy}", $lang->exportThisPage, "class='iframe' data-width='700'"); ?> </li>
include '../../common/view/header.admin.html.php'; js::set('setCounts', $lang->site->setCounts); js::set('score', commonModel::isAvailable('score')); ?> <div class='panel'> <div class='panel-heading'><strong><i class='icon-envelope'></i> <?php echo $lang->mail->common; ?> <i class='icon-arrow-right'></i> <?php echo $lang->mail->save; ?> </strong></div> <div class='panel-body'> <div class='alert alert-success'> <i class='icon-ok-sign'></i> <div class='content'><?php echo $lang->mail->successSaved; ?> </div> </div> <div><?php if ($this->post->turnon and commonModel::hasPriv('mail', 'test')) { echo html::linkButton($lang->mail->test, inlink('test')); } ?> </div> </div> </div> <?php include '../../common/view/footer.admin.html.php';
/** * Create the select code of projects. * * @param array $projects * @param int $projectID * @param string $currentModule * @param string $currentMethod * @param string $extra * @access public * @return string */ public function select($projects, $projectID, $currentModule, $currentMethod, $extra = '') { if (!$projectID) { return; } setCookie("lastProject", $projectID, $this->config->cookieLife, $this->config->webRoot); $currentProject = $this->getById($projectID); $methodName = $this->app->getMethodName(); $moduleName = $this->app->getModuleName(); $menu = "<nav id='menu'><ul class='nav'>"; $menu .= "<li><a id='currentItem' href=\"javascript:showDropMenu('project', '{$projectID}', '{$currentModule}', '{$currentMethod}', '{$extra}')\"><i class='icon-folder-open-alt'></i> <strong>{$currentProject->name}</strong> <span class='icon-caret-down'></span></a><div id='dropMenu'></div></li>"; $viewIcons = array('browse' => 'list-ul', 'kanban' => 'columns', 'outline' => 'list-alt'); $this->lang->task->browse = $this->lang->task->list; if ($methodName == 'browse' or $methodName == 'importtask') { $menu .= '<li class="divider angle"></li>'; if (isset($currentProject->members[$this->app->user->account])) { $menu .= commonModel::printLink('task', 'browse', "projectID={$projectID}&mode=assignedTo", $this->lang->task->assignedToMe, '', false, '', 'li'); } $menu .= commonModel::printLink('task', 'browse', "projectID={$projectID}&mode=all", $this->lang->task->all, '', false, '', 'li'); $menu .= commonModel::printLink('task', 'browse', "projectID={$projectID}&mode=createdBy", $this->lang->task->createdByMe, '', false, '', 'li'); $menu .= commonModel::printLink('task', 'browse', "projectID={$projectID}&mode=finishedBy", $this->lang->task->finishedByMe, '', false, '', 'li'); $menu .= commonModel::printLink('task', 'browse', "projectID={$projectID}&mode=untilToday", $this->lang->task->untilToday, '', false, '', 'li'); $menu .= commonModel::printLink('task', 'browse', "projectID={$projectID}&mode=expired", $this->lang->task->expired, '', false, '', 'li'); } else { if ($methodName == 'kanban' || $methodName == 'outline') { $menu .= '<li class="divider angle"></li>'; foreach ($this->lang->task->groups as $key => $value) { if (empty($key)) { continue; } $menu .= "<li data-group='{$key}'>" . commonModel::printLink('task', $methodName, "projectID={$projectID}&groupBy={$key}", $value, '', false) . "</li>"; } } else { if ($methodName == 'view') { $menu .= '<li class="divider angle"></li>'; $menu .= '<li class="title">' . $this->lang->{$moduleName}->view . '</li>'; } else { if ($methodName == 'batchcreate') { $menu .= '<li class="divider angle"></li>'; $menu .= '<li class="title">' . $this->lang->{$moduleName}->batchCreate . '</li>'; } else { if ($methodName == 'create') { $menu .= '<li class="divider angle"></li>'; $menu .= '<li class="title">' . $this->lang->{$moduleName}->create . '</li>'; } } } } } $menu .= "</ul>"; $menu .= "<div class='pull-right'>" . commonModel::printLink('task', 'create', "projectID={$projectID}", '<i class="icon-sitemap"></i> ' . $this->lang->task->create, 'class="btn btn-primary"', false) . "</div>"; $menu .= "<div class='pull-right'>" . commonModel::printLink('task', 'batchCreate', "projectID={$projectID}", '<i class="icon-plus"></i> ' . $this->lang->task->batchCreate, 'class="btn btn-primary"', false) . "</div>"; $menu .= "<div class='pull-right'>" . commonModel::printLink('project', 'importTask', "projectID={$projectID}", $this->lang->importIcon . $this->lang->project->import, 'class="btn btn-primary"', false) . "</div>"; if (commonModel::hasPriv('task', 'export')) { $menu .= "<div class='btn-group pull-right'>"; $menu .= "<button data-toggle='dropdown' class='btn btn-primary dropdown-toggle' type='button'>" . $this->lang->exportIcon . $this->lang->export . " <span class='caret'></span></button>"; $menu .= "<ul id='exportActionMenu' class='dropdown-menu w-100px'>"; $menu .= "<li>" . commonModel::printLink('task', 'export', "mode=all&projectID={$projectID}&orderBy={$extra}", $this->lang->exportAll, "class='iframe' data-width='700'", false) . "</li>"; $menu .= "<li>" . commonModel::printLink('task', 'export', "mode=thisPage&projectID={$projectID}&orderBy={$extra}", $this->lang->exportThisPage, "class='iframe' data-width='700'", false) . "</li>"; $menu .= "</ul>"; $menu .= "</div>"; } if ($methodName == 'browse' || $methodName == 'kanban' || $methodName == 'outline') { $taskListType = $methodName; $viewName = $this->lang->task->{$methodName}; $menu .= "<ul class='nav pull-right'>"; $menu .= "<li id='viewBar' class='dropdown'><a href='javascript:;' id='groupButton' data-toggle='dropdown' class='dropdown-toggle'><i class='icon-" . $viewIcons[$methodName] . "'></i> {$viewName} <i class='icon-caret-down'></i></a><ul class='dropdown-menu'>"; $menu .= "<li" . ($methodName == 'browse' ? " class='active'" : '') . ">" . commonModel::printLink('task', 'browse', "projectID={$projectID}", "<i class='icon-list-ul icon'></i> " . $this->lang->task->list, '', false) . "</li>"; $menu .= "<li" . ($methodName == 'kanban' ? " class='active'" : '') . ">" . commonModel::printLink('task', 'kanban', "projectID={$projectID}", "<i class='icon-columns icon'></i> " . $this->lang->task->kanban, '', false) . "</li>"; $menu .= "<li" . ($methodName == 'outline' ? " class='active'" : '') . ">" . commonModel::printLink('task', 'outline', "projectID={$projectID}", "<i class='icon-list-alt icon'></i> " . $this->lang->task->outline, '', false) . "</li>"; $menu .= '</ul></li>'; if ($methodName == 'outline') { $menu .= '<li><a href="javascript:;" id="toggleAll"><i class="icon-plus"></i></a></li>'; } $menu .= "</ul>"; } $menu .= '</nav>'; return $menu; }
/** * Get book catalog for admin. * * @param int $nodeID * @param array $serials the serial number list for all nodes. * @access public * @return void */ public function getAdminCatalog($nodeID, $serials) { $catalog = ''; $node = $this->getNodeByID($nodeID); if (!$node) { return $catalog; } $children = $this->getChildren($nodeID); if ($node->type != 'book') { $serial = $serials[$nodeID]; } $anchor = "name='node{$node->id}' id='node{$node->id}'"; $titleLink = $node->type == 'book' ? $node->title : html::a(helper::createLink('book', 'admin', "bookID={$node->id}"), $node->title); $editLink = commonModel::hasPriv('book', 'edit') ? html::a(helper::createLink('book', 'edit', "nodeID={$node->id}"), $this->lang->edit, $anchor) : ''; $delLink = empty($children) ? commonModel::hasPriv('book', 'edit') ? html::a(helper::createLink('book', 'delete', "bookID={$node->id}"), $this->lang->delete, "class='deleter'") : '' : ''; $filesLink = commonModel::hasPriv('file', 'browse') ? html::a(helper::createLink('file', 'browse', "objectType=book&objectID={$node->id}&isImage=0"), $this->lang->book->files, "data-toggle='modal' data-width='1000'") : ''; $catalogLink = commonModel::hasPriv('book', 'catalog') ? html::a(helper::createLink('book', 'catalog', "nodeID={$node->id}"), $this->lang->book->catalog) : ''; $moveLink = commonModel::hasPriv('book', 'sort') ? html::a('javascript:;', "<i class='icon-move'></i>", "class='sort sort-handle'") : ''; $childrenHtml = ''; if ($children) { $childrenHtml .= '<dl>'; foreach ($children as $child) { $childrenHtml .= $this->getAdminCatalog($child->id, $serials); } $childrenHtml .= '</dl>'; } if ($node->type == 'book') { $catalog .= "<dt class='book' data-id='" . $node->id . "'><strong>" . $titleLink . '</strong><span class="actions">' . $editLink . $catalogLink . $delLink . '</span></dt>' . $childrenHtml; } if ($node->type == 'chapter') { $catalog .= "<dd class='catalog chapter' data-id='" . $node->id . "'><strong><span class='order'>" . $serial . '</span> ' . $titleLink . '</strong><span class="actions">' . $editLink . $catalogLink . $delLink . $moveLink . '</span>' . $childrenHtml . '</dd>'; } if ($node->type == 'article') { $catalog .= "<dd class='catalog article' data-id='" . $node->id . "'><strong><span class='order'>" . $serial . '</span> ' . $node->title . '</strong><span class="actions">' . $editLink . $filesLink . $delLink . $moveLink . '</span>' . $childrenHtml . '</dd>'; } return $catalog; }
* @package ui * @version $Id$ * @link http://www.chanzhi.org */ include '../../common/view/header.admin.html.php'; ?> <div class='panel panel-templates'> <div class='cards cards-templates' data-template='<?php echo $this->config->template->{$this->device}->name; ?> ' data-theme='<?php echo $this->config->template->{$this->device}->theme; ?> '> <?php $customThemePriv = commonModel::hasPriv('ui', 'customTheme'); ?> <?php foreach ($templates as $code => $template) { ?> <?php $desc = $template['desc']; $count = count($template['themes']); $isCurrent = $this->config->template->{$this->device}->name == $code; $themeName = $isCurrent ? $this->config->template->{$this->device}->theme : 'default'; $templateRoot = $webRoot . 'template/' . $code . '/'; ?> <div class='col-card'> <div class="card-template card<?php if ($isCurrent) { echo ' current';
commonModel::printOrderLink('createdDate', $orderBy, $vars, $lang->doc->createdDate); ?> </th> <th class='w-90px {sorter:false}'><?php echo $lang->actions; ?> </th> </tr> </thead> <tbody> <?php foreach ($docs as $key => $doc) { ?> <?php $viewLink = $this->createLink('doc', 'view', "docID={$doc->id}"); $canView = commonModel::hasPriv('doc', 'view'); ?> <tr class='text-center'> <td><?php if ($canView) { echo html::a($viewLink, sprintf('%03d', $doc->id)); } else { printf('%03d', $doc->id); } ?> </td> <td class='text-left' title="<?php echo $doc->title; ?> "><nobr><?php echo $canView ? html::a($viewLink, $doc->title) : $doc->title;
* @license ZPL (http://zpl.pub/page/zplv12.html) * @author Tingting Dai <*****@*****.**> * @package order * @version $Id$ * @link http://www.ranzhico.com */ include '../../common/view/header.html.php'; js::set('mode', $mode); ?> <li id='bysearchTab'><?php echo html::a('#', "<i class='icon-search icon'></i>" . $lang->search->common); ?> </li> <div id='menuActions'> <?php if (commonModel::hasPriv('order', 'export')) { ?> <div class='btn-group'> <button data-toggle='dropdown' class='btn btn-primary dropdown-toggle' type='button'><?php echo $lang->exportIcon . $lang->export; ?> <span class='caret'></span></button> <ul id='exportActionMenu' class='dropdown-menu'> <li><?php commonModel::printLink('order', 'export', "mode=all&&orderBy={$orderBy}", $lang->exportAll, "class='iframe' data-width='700'"); ?> </li> <li><?php commonModel::printLink('order', 'export', "mode=thisPage&&orderBy={$orderBy}", $lang->exportThisPage, "class='iframe' data-width='700'"); ?> </li>
<?php } ?> <?php } ?> </tbody> <tfoot> <tr> <td colspan='10'> <div class='pull-left'><?php echo html::selectButton() . html::submitButton($lang->close); ?> </div> <?php $pager->show(); ?> </td> </tr> </tfoot> </table> <?php if (commonModel::hasPriv('task', 'batchClose')) { ?> </form> <?php } ?> </div> <?php include '../../common/view/footer.html.php';
<?php echo html::hidden('module', $module); echo html::hidden('actionURL', $actionURL); echo html::hidden('groupItems', $groupItems); echo "<div class='btn-group'>"; echo html::submitButton($lang->search->common, 'btn-primary btn', ''); echo html::commonButton($lang->search->reset, 'btn', 'onclick=resetForm();'); echo html::commonButton($lang->save, 'btn', 'onclick=saveQuery()'); echo '</div>'; ?> </td> <td class='w-120px'> <div class='input-group'> <?php echo html::select('queryID', $queries, $queryID, 'onchange=executeQuery(this.value) class=form-control'); if (commonModel::hasPriv('search', 'deleteQuery')) { echo "<span class='input-group-btn'>" . html::a('javascript:deleteQuery()', '<i class="icon-remove"></i>', 'class=btn') . '</span>'; } ?> </div> </td> </tr> </table> <div id='moreOrLite'> <a id="searchmore" href="javascript:showmore()"><i class="icon-double-angle-down icon-2x"></i></a> <a id="searchlite" href="javascript:showlite()"><i class="icon-double-angle-up icon-2x"></i></a> <?php echo html::hidden('formType', 'lite'); ?> </div> </form>
/** * Create the module menu. * * @param string $currentModule * @static * @access public * @return void */ public static function createModuleMenu($currentModule) { global $lang, $app; if (!isset($lang->{$currentModule}->menu)) { return false; } $string = "<ul class='nav-left nav nav-primary nav-stacked'>\n"; /* Get menus of current module and current method. */ $moduleMenus = $lang->{$currentModule}->menu; $currentMethod = $app->getMethodName(); /* Cycling to print every menus of current module. */ foreach ($moduleMenus as $methodName => $methodMenu) { if (is_array($methodMenu)) { $methodAlias = $methodMenu['alias']; $methodLink = $methodMenu['link']; } else { $methodAlias = ''; $methodLink = $methodMenu; } /* Split the methodLink to label, module, method, vars. */ list($label, $module, $method, $vars) = explode('|', $methodLink); $label .= '<i class="icon-chevron-right"></i>'; if (commonModel::hasPriv($module, $method)) { $class = ''; if ($module == $currentModule && $method == $currentMethod) { $class = " class='active'"; } if ($module == $currentModule && strpos($methodAlias, $currentMethod) !== false) { $class = " class='active'"; } $string .= "<li{$class}>" . html::a(helper::createLink($module, $method, $vars), $label) . "</li>\n"; } } $string .= "</ul>\n"; return $string; }
* @license ZPL (http://zpl.pub/page/zplv12.html) * @author Tingting Dai <*****@*****.**> * @package customer * @version $Id$ * @link http://www.ranzhico.com */ include '../../common/view/header.html.php'; js::set('mode', $mode); ?> <li id='bysearchTab'><?php echo html::a('#', "<i class='icon-search icon'></i>" . $lang->search->common); ?> </li> <div id='menuActions'> <?php if (commonModel::hasPriv('customer', 'export')) { ?> <div class='btn-group'> <button data-toggle='dropdown' class='btn btn-primary dropdown-toggle' type='button'><?php echo $lang->exportIcon . $lang->export; ?> <span class='caret'></span></button> <ul id='exportActionMenu' class='dropdown-menu'> <li><?php commonModel::printLink('customer', 'export', "mode=all&orderBy={$orderBy}", $lang->exportAll, "class='iframe' data-width='700'"); ?> </li> <li><?php commonModel::printLink('customer', 'export', "mode=thisPage&orderBy={$orderBy}", $lang->exportThisPage, "class='iframe' data-width='700'"); ?> </li>
echo $lang->file->addedBy; ?> </th> <th class='text-center w-160px'><?php echo $lang->file->addedDate; ?> </th> <th class='text-center w-150px'><?php echo $lang->actions; ?> </th> </tr> </thead> <tbody> <?php $downloadPriv = commonModel::hasPriv('file', 'download'); ?> <?php foreach ($files as $file) { ?> <tr class='text-center text-middle'> <td><?php echo $file->id; ?> </td> <td> <?php if ($file->isImage) { echo $downloadPriv ? html::a(inlink('download', "id={$file->id}"), html::image($file->smallURL, "class='image-small' title='{$file->title}'"), "target='_blank'") : html::image($file->smallURL, "class='image-small' title='{$file->title}'"); if ($file->primary == 1) { echo '<small class="label label-success">' . $lang->file->primary . '</small>';
/** * Create trade of refund. * * @param int $refundID * @access public * @return void */ public function createTrade($refundID) { if (!commonModel::hasPriv('refund', 'reimburse')) { $this->deny('refund', 'reimburse'); } $this->app->loadLang('trade', 'cash'); if ($_POST) { $this->refund->createTrade($refundID); if (dao::isError()) { $this->send(array('result' => 'fail', 'message' => dao::getError())); } $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload')); } $this->view->title = $this->lang->refund->common; $this->view->refundID = $refundID; $this->view->depositorList = $this->loadModel('depositor', 'cash')->getPairs(); $this->display(); }
echo $lang->wechat->message->type; ?> </th> <th class='w-200px'><?php echo $lang->wechat->message->time; ?> </th> <th class='w-100px'><?php echo $lang->wechat->message->reply; ?> </th> </tr> </thead> <tbody> <?php $replyPriv = commonModel::hasPriv('wechat', 'reply'); ?> <?php foreach ($messageList as $message) { ?> <tr class='text-center'> <td class='w-100px text-right'><?php echo $message->fromUserName . $lang->colon; ?> </td> <td class='text-left'><?php echo $message->content; ?> </td> <td><?php echo $lang->wechat->message->typeList[$message->type];
commonModel::printLink('trade', 'create', 'type=out', "{$lang->trade->createOut}", "class='btn btn-primary'"); ?> <?php commonModel::printLink('trade', 'transfer', '', "{$lang->trade->transfer}", "class='btn btn-primary'"); ?> <?php commonModel::printLink('trade', 'inveset', '', "{$lang->trade->inveset}", "class='btn btn-primary'"); ?> <?php commonModel::printLink('trade', 'batchcreate', '', "{$lang->trade->batchCreate}", "class='btn btn-primary'"); ?> <?php commonModel::printLink('trade', 'import', '', "{$lang->trade->import}", "class='btn btn-primary' data-toggle='modal'"); ?> <?php if (commonModel::hasPriv('trade', 'export')) { ?> <div class='btn-group'> <button data-toggle='dropdown' class='btn btn-primary dropdown-toggle' type='button'><?php echo $lang->export; ?> <span class='caret'></span></button> <ul id='exportActionMenu' class='dropdown-menu pull-right'> <li><?php commonModel::printLink('trade', 'export', "mode=all&orderBy={$orderBy}", $lang->exportAll, "class='iframe' data-width='700'"); ?> </li> <li><?php commonModel::printLink('trade', 'export', "mode=thisPage&orderBy={$orderBy}", $lang->exportThisPage, "class='iframe' data-width='700'"); ?> </li>
/** * print link; * * @param string $module * @param string $method * @param string $vars * @param string $label * @param string $misc * @static * @access public * @return bool */ public static function printLink($module, $method, $vars = '', $label, $misc = '') { if (!commonModel::hasPriv($module, $method)) { return false; } echo html::a(helper::createLink($module, $method, $vars), $label, $misc); return true; }
<?php } ?> </tbody> </table> <div class='table-footer'> <div class='pull-left batch-actions'> <?php $closeActionLink = $this->createLink('sys.todo', 'batchClose'); ?> <div class='pull-left close-action'><?php echo html::selectButton() . html::commonButton($lang->close, 'btn btn-primary', "onclick=\"setFormAction('{$closeActionLink}')\""); ?> </div> <?php if (commonModel::hasPriv('todo', 'import2Today')) { $actionLink = $this->createLink('todo', 'import2Today'); echo "<div class='input-group import-action'>"; echo "<div class='datepicker-wrapper datepicker-date'>" . html::input('date', date('Y-m-d'), "class='form-control form-date'") . '</div>'; echo "<span class='input-group-btn'>"; echo html::commonButton($lang->todo->import, 'btn btn-default', "onclick=\"setFormAction('{$actionLink}')\""); echo '</span>'; echo '</div>'; } ?> </div> <?php $pager->show(); ?> </div> </form>
* @license ZPL (http://zpl.pub/page/zplv12.html) * @author Yidong Wang <*****@*****.**> * @package contract * @version $Id$ * @link http://www.ranzhico.com */ include '../../common/view/header.html.php'; js::set('mode', $mode); ?> <li id='bysearchTab'><?php echo html::a('#', "<i class='icon-search icon'></i>" . $lang->search->common); ?> </li> <div id='menuActions'> <?php if (commonModel::hasPriv('contract', 'export')) { ?> <div class='btn-group'> <button data-toggle='dropdown' class='btn btn-primary dropdown-toggle' type='button'><?php echo $lang->exportIcon . $lang->export; ?> <span class='caret'></span></button> <ul id='exportActionMenu' class='dropdown-menu'> <li><?php commonModel::printLink('contract', 'export', "mode=all&orderBy={$orderBy}", $lang->exportAll, "class='iframe' data-width='700'"); ?> </li> <li><?php commonModel::printLink('contract', 'export', "mode=thisPage&orderBy={$orderBy}", $lang->exportThisPage, "class='iframe' data-width='700'"); ?> </li>
commonModel::printLink('package', 'upload', '', $lang->survey->upload, "class='btn btn-primary' data-toggle='modal'"); ?> <?php commonModel::printLink('package', 'obtain', '', $lang->survey->obtain, "class='btn btn-primary'"); ?> </div> </div> <div class='panel-body'> <div class='cards'> <?php $structurePriv = commonModel::hasPriv('package', 'structure'); $deactivatePriv = commonModel::hasPriv('package', 'deactivate'); $activatePriv = commonModel::hasPriv('package', 'activate'); $uninstallPriv = commonModel::hasPriv('package', 'uninstall'); $installPriv = commonModel::hasPriv('package', 'install'); $erasePriv = commonModel::hasPriv('package', 'erase'); ?> <?php foreach ($packages as $package) { ?> <div class='col-md-6'><div class='card'> <div class='card-heading'><strong><?php echo $package->name; ?> </strong></div> <div class='card-content text-muted'><?php echo $package->desc; ?> </div> <div class='card-actions'> <div class='pull-right'>
/** * Check privilege for action. * * @param object $action * @access public * @return bool */ public function checkPriv($action) { $canView = true; if ($action->customer) { static $customers = array(); if (empty($customers)) { $customers = $this->loadModel('customer', 'crm')->getCustomersSawByMe(); } if (!in_array($action->customer, $customers)) { $canView = false; } } if ($action->contact) { static $contacts = array(); if (empty($contacts)) { $contacts = $this->loadModel('contact', 'crm')->getContactsSawByMe(); } if (!in_array($action->contact, $contacts)) { $canView = false; } } if ($action->objectType == 'order') { static $orders = array(); if (empty($orders)) { $orders = $this->loadModel('order', 'crm')->getOrdersSawByMe(); } if (!in_array($action->objectID, $orders)) { $canView = false; } } if ($action->objectType == 'project' && !$this->loadModel('project', 'oa')->checkPriv($action->objectID)) { $canView = false; } if ($action->objectType == 'task') { $task = $this->loadModel('task')->getByID($action->objectID); if (!$this->loadModel('task', 'sys')->checkPriv($task, 'view')) { $canView = false; } } if ($action->objectType == 'trade') { $trade = $this->loadModel('trade', 'cash')->getByID($action->objectID); $rights = $this->app->user->rights; if (empty($trade) or $this->app->user->admin != 'super' and $trade->type == 'out' and (!isset($rights['tradebrowse']['out']) or !$this->loadModel('tree')->hasRight($trade->category))) { $canView = false; } } if ($action->objectType == 'todo') { $todo = $this->loadModel('todo')->getByID($action->objectID); if (empty($todo) or $this->app->user->account != $todo->account && $this->app->user->account != $todo->assignedTo) { $canView = false; } } $objectType = $action->objectType; $actionType = $action->action; if (isset($this->lang->action->label->{$objectType})) { $objectLabel = $this->lang->action->label->{$objectType}; if (!is_array($objectLabel)) { $action->objectLabel = $objectLabel; } if (is_array($objectLabel) and isset($objectLabel[$actionType])) { $action->objectLabel = $objectLabel[$actionType]; } if (strpos($action->objectLabel, '|') !== false) { list($objectLabel, $moduleName, $methodName, $vars) = explode('|', $action->objectLabel); $action->objectLabel = $objectLabel; if (!$this->loadModel('common')->isOpenMethod($moduleName, $methodName) and !commonModel::hasPriv($moduleName, $methodName)) { $canView = false; } } } if (!commonModel::hasAppPriv($action->appName)) { $canView = false; } return $canView; }
/** * Get block list for account. * * @param string $appName * @access public * @return void */ public function getBlockList($appName = 'sys') { $blocks = $this->dao->select('*')->from(TABLE_BLOCK)->where('account')->eq($this->app->user->account)->andWhere('app')->eq($appName)->andWhere('hidden')->eq(0)->orderBy('`order`')->fetchAll('order'); foreach ($blocks as $key => $block) { if (strpos('html,allEntries,dynamic', $block->block) !== false) { continue; } $module = $block->block; $method = 'browse'; if (strpos('blog, project', $block->block) !== false) { $method = 'index'; } if ($block->block == 'attend') { $method = 'personal'; } if ($block->block == 'thread') { $module = 'forum'; $method = 'board'; } if (!commonModel::hasPriv($module, $method)) { unset($blocks[$key]); } } return $blocks; }
/** * Build operate menu. * * @param object $purchase * @param string $class * @param string $type * @access public * @return string */ public function buildOperateMenu($purchase, $class = '', $type = 'browse') { $menu = ''; $canCreateRecord = commonModel::hasPriv('action', 'createRecord'); $canReceive = commonModel::hasPriv('contract', 'receive'); $canDelivery = commonModel::hasPriv('contract', 'delivery'); $canFinish = commonModel::hasPriv('contract', 'finish'); $canEdit = commonModel::hasPriv('contract', 'edit'); $canCancel = commonModel::hasPriv('contract', 'cancel'); $canDelete = commonModel::hasPriv('contract', 'delete'); if ($type == 'view') { $menu .= "<div class='btn-group'>"; } if ($canCreateRecord) { $menu .= html::a(helper::createLink('action', 'createRecord', "objectType=purchase&objectID={$purchase->id}&customer={$purchase->customer}"), $this->lang->purchase->record, "class='{$class}' data-toggle='modal' data-type='iframe'"); } if ($purchase->return != 'done' and $purchase->status == 'normal' and $canReceive) { $menu .= html::a(helper::createLink('cash.purchase', 'receive', "purchase={$purchase->id}"), $this->lang->purchase->return, "data-toggle='modal' class='{$class}'"); } else { $menu .= "<a href='###' disabled='disabled' class='disabled {$class}'>" . $this->lang->purchase->return . '</a> '; } if ($purchase->delivery != 'done' and $purchase->status == 'normal' and $canDelivery) { $menu .= html::a(helper::createLink('cash.purchase', 'delivery', "purchase={$purchase->id}"), $this->lang->purchase->delivery, "data-toggle='modal' class='{$class}'"); } else { $menu .= "<a href='###' disabled='disabled' class='disabled {$class}'>" . $this->lang->purchase->delivery . '</a> '; } if ($type == 'view') { $menu .= "</div><div class='btn-group'>"; } if ($purchase->status == 'normal' and $purchase->return == 'done' and $purchase->delivery == 'done' and $canFinish) { $menu .= html::a(helper::createLink('cash.purchase', 'finish', "purchase={$purchase->id}"), $this->lang->finish, "data-toggle='modal' class='{$class}'"); } else { $menu .= "<a href='###' disabled='disabled' class='disabled {$class}'>" . $this->lang->finish . '</a> '; } if ($canEdit) { $menu .= html::a(helper::createLink('cash.purchase', 'edit', "purchase={$purchase->id}"), $this->lang->edit, "class='{$class}'"); } if ($type == 'view') { $menu .= "</div><div class='btn-group'>"; if ($purchase->status == 'normal' and !($purchase->return == 'done' and $purchase->delivery == 'done') and $canCancel) { $menu .= html::a(helper::createLink('cash.purchase', 'cancel', "purchase={$purchase->id}"), $this->lang->cancel, "data-toggle='modal' class='{$class}'"); } else { $menu .= "<a href='###' disabled='disabled' class='disabled {$class}'>" . $this->lang->cancel . '</a> '; } if ($purchase->status == 'canceled' or $purchase->status == 'normal' and !($purchase->return == 'done' and $purchase->delivery == 'done') and $canDelete) { $menu .= html::a(helper::createLink('cash.purchase', 'delete', "purchase={$purchase->id}"), $this->lang->delete, "class='deleter {$class}'"); } else { $menu .= "<a href='###' disabled='disabled' class='disabled {$class}'>" . $this->lang->delete . '</a> '; } } if ($type == 'browse') { $menu .= "<div class='dropdown'><a data-toggle='dropdown' href='javascript:;'>" . $this->lang->more . "<span class='caret'></span> </a><ul class='dropdown-menu pull-right'>"; if ($purchase->status == 'normal' and !($purchase->return == 'done' and $purchase->delivery == 'done') and $canCancel) { $menu .= "<li>" . html::a(helper::createLink('cash.purchase', 'cancel', "purchase={$purchase->id}"), $this->lang->cancel, "data-toggle='modal' class='{$class}'") . "</li>"; } else { $menu .= "<li><a href='###' disabled='disabled' class='disabled {$class}'>" . $this->lang->cancel . '</a></li> '; } if ($purchase->status == 'canceled' or $purchase->status == 'normal' and !($purchase->return == 'done' and $purchase->delivery == 'done') and $canDelete) { $menu .= "<li>" . html::a(helper::createLink('cash.purchase', 'delete', "purchase={$purchase->id}"), $this->lang->delete, "class='reloadDeleter {$class}'") . "</li>"; } else { $menu .= "<li><a href='###' disabled='disabled' class='disabled {$class}'>" . $this->lang->delete . '</a></li> '; } $menu .= '</ul>'; } $menu .= "</div>"; return $menu; }
?> <?php if (!empty($treeModuleMenu)) { ?> <div class='col-md-2'> <div class="leftmenu affix hiddden-xs hidden-sm"> <div class='panel category-nav'> <div class='panel-body'> <?php echo $treeModuleMenu; ?> <?php if (!empty($treeManageLink)) { ?> <div class='text-right'><?php if (commonModel::hasPriv('tree', 'browse')) { echo $treeManageLink; } ?> </div> <?php } ?> </div> </div> </div> </div> <div class='col-md-10'> <?php } ?>
/** * Print link to an modules' methd. * * Before printing, check the privilege first. If no privilege, return fasle. Else, print the link, return true. * * @param string $module the module name * @param string $method the method * @param string $vars vars to be passed * @param string $label the label of the link * @param string $misc others * @param bool $print * @param bool $onlyBody * @param string $type li * @static * @access public * @return bool */ public static function printLink($module, $method, $vars = '', $label, $misc = '', $print = true, $onlyBody = false, $type = '') { if (!commonModel::hasPriv($module, $method)) { return false; } $content = ''; $canClick = commonModel::checkPrivByVars($module, $method, $vars); $link = helper::createLink($module, $method, $vars, '', $onlyBody); if (!$canClick) { $misc = str_replace("class='", "disabled='disabled' class='disabled ", $misc); $misc = str_replace("data-toggle='modal'", ' ', $misc); $misc = str_replace("deleter", ' ', $misc); if (strpos($misc, "class='") === false) { $misc .= " class='disabled' disabled='disabled'"; } } if ($type == 'li') { $content .= '<li' . ($canClick ? '' : " disabled='disabled' class='disabled'") . '>'; } $content .= html::a($canClick ? $link : 'javascript:void(0)', $label, $misc); if ($type == 'li') { $content .= '</li>'; } if ($print !== false) { echo $content; } return $content; }