/** * @copydoc PKPHandler::authorize() */ function authorize($request, &$args, $roleAssignments) { // Make sure the user can edit the submission in the request. import('lib.pkp.classes.security.authorization.SubmissionAccessPolicy'); $this->addPolicy(new SubmissionAccessPolicy($request, $args, $roleAssignments, 'assocId')); return parent::authorize($request, $args, $roleAssignments); }
/** * Upload a profile image. * @return boolean True iff success. */ function uploadProfileImage() { import('classes.file.PublicFileManager'); $publicFileManager = new PublicFileManager(); $user = $this->getUser(); $type = $publicFileManager->getUploadedFileType('uploadedFile'); $extension = $publicFileManager->getImageExtension($type); if (!$extension) { return false; } $uploadName = 'profileImage-' . (int) $user->getId() . $extension; if (!$publicFileManager->uploadSiteFile('uploadedFile', $uploadName)) { return false; } $filePath = $publicFileManager->getSiteFilesPath(); list($width, $height) = getimagesize($filePath . '/' . $uploadName); if ($width > PROFILE_IMAGE_MAX_WIDTH || $height > PROFILE_IMAGE_MAX_HEIGHT || $width <= 0 || $height <= 0) { $userSetting = null; $user->updateSetting('profileImage', $userSetting); $publicFileManager->removeSiteFile($filePath); return false; } $user->updateSetting('profileImage', array('name' => $publicFileManager->getUploadedFileName('uploadedFile'), 'uploadName' => $uploadName, 'width' => $width, 'height' => $height, 'dateUploaded' => Core::getCurrentDate())); return true; }
public function __construct(){ parent::__construct(); Language::read('member_store_statistics'); import('function.statistics'); import('function.datehelper'); $model = Model('stat'); //存储参数 $this->search_arr = $_REQUEST; //处理搜索时间 if (in_array($this->search_arr['op'],array('price','hotgoods'))){ $this->search_arr = $model->dealwithSearchTime($this->search_arr); //获得系统年份 $year_arr = getSystemYearArr(); //获得系统月份 $month_arr = getSystemMonthArr(); //获得本月的周时间段 $week_arr = getMonthWeekArr($this->search_arr['week']['current_year'], $this->search_arr['week']['current_month']); Tpl::output('year_arr', $year_arr); Tpl::output('month_arr', $month_arr); Tpl::output('week_arr', $week_arr); } Tpl::output('search_arr', $this->search_arr); /** * 处理商品分类 */ $this->choose_gcid = ($t = intval($_REQUEST['choose_gcid']))>0?$t:0; $gccache_arr = Model('goods_class')->getGoodsclassCache($this->choose_gcid,3); $this->gc_arr = $gccache_arr['showclass']; Tpl::output('gc_json',json_encode($gccache_arr['showclass'])); Tpl::output('gc_choose_json',json_encode($gccache_arr['choose_gcid'])); }
/** * Public view book for review details. */ function viewBookForReview($args = array(), &$request) { $this->setupTemplate(true); $journal =& $request->getJournal(); $journalId = $journal->getId(); $bfrPlugin =& PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME); $bookId = !isset($args) || empty($args) ? null : (int) $args[0]; $bfrDao =& DAORegistry::getDAO('BookForReviewDAO'); // Ensure book for review is valid and for this journal if ($bfrDao->getBookForReviewJournalId($bookId) == $journalId) { $book =& $bfrDao->getBookForReview($bookId); $bfrPlugin->import('classes.BookForReview'); // Ensure book is still available if ($book->getStatus() == BFR_STATUS_AVAILABLE) { $isAuthor = Validation::isAuthor(); import('classes.file.PublicFileManager'); $publicFileManager = new PublicFileManager(); $coverPagePath = $request->getBaseUrl() . '/'; $coverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/'; $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('coverPagePath', $coverPagePath); $templateMgr->assign('locale', AppLocale::getLocale()); $templateMgr->assign_by_ref('bookForReview', $book); $templateMgr->assign('isAuthor', $isAuthor); $templateMgr->display($bfrPlugin->getTemplatePath() . 'bookForReview.tpl'); } } $request->redirect(null, 'booksForReview'); }
/** * @copydoc PKPHandler::authorize() */ function authorize($request, &$args, $roleAssignments) { // Require a submission import('classes.security.authorization.SubmissionAccessPolicy'); $this->addPolicy(new SubmissionAccessPolicy($request, $args, $roleAssignments, 'submissionId')); return parent::authorize($request, $args, $roleAssignments); }
/** * Displays the author dashboard. * @param $args array * @param $request PKPRequest */ function submission($args, $request) { // Pass the authorized submission on to the template. $this->setupTemplate($request); $templateMgr = TemplateManager::getManager($request); $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); $templateMgr->assign('submission', $submission); // Link actions. import('lib.pkp.controllers.modals.submissionMetadata.linkAction.AuthorViewMetadataLinkAction'); $templateMgr->assign('viewMetadataAction', new AuthorViewMetadataLinkAction($request, $submission->getId())); import('lib.pkp.controllers.modals.documentLibrary.linkAction.SubmissionLibraryLinkAction'); $templateMgr->assign('submissionLibraryAction', new SubmissionLibraryLinkAction($request, $submission->getId())); $workflowStages = WorkflowStageDAO::getWorkflowStageKeysAndPaths(); $stageNotifications = array(); foreach (array_keys($workflowStages) as $stageId) { $stageNotifications[$stageId] = false; } $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /* @var $editDecisionDao EditDecisionDAO */ $stageDecisions = $editDecisionDao->getEditorDecisions($submission->getId()); $stagesWithDecisions = array(); foreach ($stageDecisions as $decision) { $stagesWithDecisions[$decision['stageId']] = $decision['stageId']; } $workflowStages = WorkflowStageDAO::getStageStatusesBySubmission($submission, $stagesWithDecisions, $stageNotifications); $templateMgr->assign('workflowStages', $workflowStages); return $templateMgr->display('authorDashboard/authorDashboard.tpl'); }
function addTinyMCE() { $journalId = $this->journalId; $plugin =& $this->plugin; $templateMgr =& TemplateManager::getManager(); // Enable TinyMCE with specific params $additionalHeadData = $templateMgr->get_template_vars('additionalHeadData'); import('classes.file.JournalFileManager'); $publicFileManager = new PublicFileManager(); $tinyMCE_script = ' <script language="javascript" type="text/javascript" src="' . Request::getBaseUrl() . '/' . TINYMCE_JS_PATH . '/tiny_mce.js"></script> <script language="javascript" type="text/javascript"> tinyMCE.init({ mode : "textareas", plugins : "safari,spellchecker,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,pagebreak,", theme_advanced_buttons1_add : "fontsizeselect", theme_advanced_buttons2_add : "separator,preview,separator,forecolor,backcolor", theme_advanced_buttons2_add_before: "search,replace,separator", theme_advanced_buttons3_add_before : "tablecontrols,separator", theme_advanced_buttons3_add : "media,separator", theme_advanced_buttons4 : "cut,copy,paste,pastetext,pasteword,separator,styleprops,|,spellchecker,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,print,separator", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", relative_urls : false, document_base_url : "' . Request::getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journalId) . '/", theme : "advanced", theme_advanced_layout_manager : "SimpleLayout", extended_valid_elements : "span[*], div[*]", spellchecker_languages : "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv" }); </script>'; $templateMgr->assign('additionalHeadData', $additionalHeadData . "\n" . $tinyMCE_script); }
/** * 保存申请单 * * @param $data */ public function orderSave($data) { import("@.Action.AutoNo.AutoNoAction"); $orderno = ''; $orderno = ''; $orderhead = new PurchaseOrderHeadDao(); $orderdetail = new PurchaseOrderDetailDao(); $head = $data["head"]; $detail = $data["detail"]; try { $orderhead->startTrans(); $orderdetail->startTrans(); //head if ($head["id"] == null) { $orderno = AutoNoAction::getAutoNo('orderno'); $head["orderNo"] = $orderno; $reuslt = $orderhead->add($head); if (!$reuslt) { throw new Exception("新增申请单头出错!"); $orderhead->rollback(); } } else { $orderno = $head["orderNo"]; $reuslt = $orderhead->save($head); if (!$reuslt) { throw new Exception("保存申请单头出错!"); $orderhead->rollback(); } } //detail $orderdetail->startTrans(); $result = $orderdetail->deleteAll("orderNo = '" . $head["orderNo"] . "'"); if (!$result) { throw new Exception("删除申请单明细出错!"); $orderhead->rollback(); $orderdetail->rollback(); } foreach ($detail as $item) { $item["orderNo"] = $head["orderNo"]; if (trim($item["goodsNo"]) == '' || $item["goodsNo"] == null) { continue; } $vo = $orderdetail->createVo('add', '', 'id', 0, $item); $result = $orderdetail->add($vo); if (!$result) { throw new Exception("保存申请单明细出错!"); $orderhead->rollback(); $orderdetail->rollback(); } } } catch (Exception $e) { throw new ExcelDateUtil($e); $orderdetail->rollback(); $orderhead->rollback(); } //commit; $orderhead->commit(); $orderdetail->commit(); return $orderno; }
private function _upload() { import("@.ORG.Util.UploadFile"); $module = strtolower($_REQUEST["module"]); $upload = new UploadFile(); $upload->subFolder = $module; $upload->savePath = C("SAVE_PATH"); $upload->saveRule = uniqid; $upload->autoSub = true; $upload->subType = "date"; if (!$upload->upload()) { $this->error($upload->getErrorMsg()); } else { //取得成功上传的文件信息 $uploadList = $upload->getUploadFileInfo(); $File = M("File"); $File->create($uploadList[0]); $File->create_time = time(); $user_id = get_user_id(); $File->user_id = $user_id; $fileId = $File->add(); $fileInfo = $uploadList[0]; $fileInfo['id'] = $fileId; $fileInfo['error'] = 0; $fileInfo['url'] = $fileInfo['savepath'] . $fileInfo['savename']; //header("Content-Type:text/html; charset=utf-8"); exit(json_encode($fileInfo)); //$this->success ('上传成功!'); } }
/** * Save changes to program settings. */ function saveProgramSettings() { $this->validate(); $this->setupTemplate(true); $schedConf =& Request::getSchedConf(); if (!$schedConf) { Request::redirect(null, null, 'index'); } import('classes.manager.form.ProgramSettingsForm'); $settingsForm = new ProgramSettingsForm(); $settingsForm->readInputData(); $formLocale = $settingsForm->getFormLocale(); $programTitle = Request::getUserVar('programFileTitle'); $editData = false; if (Request::getUserVar('uploadProgramFile')) { if (!$settingsForm->uploadProgram('programFile', $formLocale)) { $settingsForm->addError('programFile', Locale::translate('common.uploadFailed')); } $editData = true; } elseif (Request::getUserVar('deleteProgramFile')) { $settingsForm->deleteProgram('programFile', $formLocale); $editData = true; } if (!$editData && $settingsForm->validate()) { $settingsForm->execute(); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign(array('currentUrl' => Request::url(null, null, null, 'program'), 'pageTitle' => 'schedConf.program', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, null, Request::getRequestedPage()), 'backLinkLabel' => 'manager.conferenceSiteManagement')); $templateMgr->display('common/message.tpl'); } else { $settingsForm->display(); } }
protected function sendEmail($smtpemailto, $mailsubject, $text) { import("ORG.Util.Smtp"); $smtpserver = "smtp.126.com"; //SMTP服务器 $smtpserverport = 25; //SMTP服务器端口 $smtpusermail = "*****@*****.**"; //SMTP服务器的用户邮箱 //$smtpemailto = "*****@*****.**";//发送给谁 $smtpuser = "******"; //SMTP服务器的用户帐号 $smtppass = "******"; //SMTP服务器的用户密码 //$mailsubject = "[Ty]";//邮件主题 $mailbody = $text; //邮件内容 $mailtype = "HTML"; //邮件格式(HTML/TXT),TXT为文本邮件 $smtp = new smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass); //这里面的一个true是表示使用身份验证,否则不使用身份验证. $smtp->debug = FALSE; //是否显示发送的调试信息 $result = $smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype); return $result; }
/** * Constructor. */ function Help() { parent::PKPHelp(); import('classes.help.OJSHelpMappingFile'); $mainMappingFile = new OJSHelpMappingFile(); $this->addMappingFile($mainMappingFile); }
/** * @see GridFeature::gridInitialize() */ function gridInitialize($args) { $grid = $args['grid']; // Add checkbox column to the grid. import('lib.pkp.classes.controllers.grid.feature.selectableItems.ItemSelectionGridColumn'); $grid->addColumn(new ItemSelectionGridColumn($grid->getSelectName())); }
public function publist() { $Pub = D('pub'); if (isset($_GET['pid'])) { $_GET['pid'] = intval($_GET['pid']); $Pub->where('id=' . $_GET['pid'])->delete(); header('Location: ' . __ADMIN__ . '/Pub/publist'); } import('ORG.Util.Page'); // 导入分页类 $count = $Pub->count(); // 查询满足要求的总记录数 $Page = new Page($count, 25); // 实例化分页类 传入总记录数和每页显示的记录数 $show = $Page->show(); // 分页显示输出 // 进行分页数据查询 注意limit方法的参数要使用Page类的属性 $list = $Pub->order('pubtime desc')->limit($Page->firstRow . ',' . $Page->listRows)->select(); $this->assign('list', $list); // 赋值数据集 $this->assign('page', $show); // 赋值分页输出 $this->display(); // 输出模板 }
function querylogbytime() { import('ORG.Util.Page'); $log_model = M('log'); $where = ''; if ($this->isPost() || isset($_REQUEST['starttime'])) { $starttime = trim($_REQUEST['starttime']); $endtime = trim($_REQUEST['endtime']); $where = "opertime>='" . $starttime . "' and opertime<='" . $endtime . "'"; $account = M('account'); $nav = $this->infinite($account->field('id,loginname,ownid')->order('id ASC')->select(), $_REQUEST['accountid']); $ids = $_REQUEST['accountid'] . ','; foreach ($nav as $k => $v) { $ids .= $v['id'] . ','; } $ids = rtrim($ids, ','); $where .= ' AND accountid in(' . $ids . ')'; } $pagesize = 16; $count = $log_model->where($where)->count(); // 查询满足要求的总记录数 //print_r($count); $Page = new Page($count, $pagesize); // 实例化分页类 传入总记录数和每页显示的记录数 $logdata = $log_model->where($where)->limit($Page->firstRow . ',' . $Page->listRows)->select(); $nav = $this->infinite($account->field('id,loginname,ownid')->order('id ASC')->select(), $_SESSION['accountid']); $this->assign('nav', $nav); $logdata = $this->formatfield($logdata); $this->assign('logdata', $logdata); //赋值数据集 $this->assign('page', $Page->show()); //赋值分页输出 $this->display('index'); }
function displayPaymentForm($queuedPaymentId, &$queuedPayment) { if (!$this->isConfigured()) { return false; } $journal =& Request::getJournal(); $templateMgr =& TemplateManager::getManager(); $user =& Request::getUser(); $templateMgr->assign('itemName', $queuedPayment->getName()); $templateMgr->assign('itemDescription', $queuedPayment->getDescription()); if ($queuedPayment->getAmount() > 0) { $templateMgr->assign('itemAmount', $queuedPayment->getAmount()); $templateMgr->assign('itemCurrencyCode', $queuedPayment->getCurrencyCode()); } $templateMgr->assign('manualInstructions', $this->getSetting($journal->getJournalId(), 'manualInstructions')); $templateMgr->display($this->getTemplatePath() . 'paymentForm.tpl'); if ($queuedPayment->getAmount() > 0) { import('mail.MailTemplate'); $contactName = $journal->getSetting('contactName'); $contactEmail = $journal->getSetting('contactEmail'); $mail =& new MailTemplate('MANUAL_PAYMENT_NOTIFICATION'); $mail->setFrom($contactEmail, $contactName); $mail->addRecipient($contactEmail, $contactName); $mail->assignParams(array('journalName' => $journal->getJournalTitle(), 'userFullName' => $user ? $user->getFullName() : '(' . Locale::translate('common.none') . ')', 'userName' => $user ? $user->getUsername() : '(' . Locale::translate('common.none') . ')', 'itemName' => $queuedPayment->getName(), 'itemCost' => $queuedPayment->getAmount(), 'itemCurrencyCode' => $queuedPayment->getCurrencyCode())); $mail->send(); } }
public function __construct() { self::$is_smarty = C('template-is_smarty'); if (self::$is_smarty === true) { //说明使用的是smarty模板 import(FRAMEWORK_PATH . 'Class' . DS . 'libs' . DS . 'Smarty.class.php'); $this->smarty = new Smarty(); //Smarty允许有两种特殊的编译设置存在: //1、 任何时候都不自动重新编译(上线阶段):只有没有该文件的编译文件时才生成,模板文件或者配置文件的更改,不会引发重新编译。 //$smarty->setCompile_check(true);//默认为true,false表示任何时候都不在文件发生变更的情况下生成编译文件,除了无编译文件。 //$smarty->getCompile_check();//获得当前编译检查的设置 //2、任何时候都重新编译(调试阶段):任何时候都重新编译。 $this->smarty->setForce_compile(APP_DEBUG); //默认为false,true表示每次都重新编译(启用缓存的话,每次都重新缓存) //$smarty->getForce_compile();//获得当前强制编译的设置 $this->smarty->debugging = APP_DEBUG; //开启缓存 $this->smarty->setCaching(C('template-cache')); //$this->smarty->getCaching();//获取当前缓存状态,默认是false关闭的 $this->smarty->setcache_lifetime(CACHE_TIME_OUT); //设置缓存时间单位秒 $this->smarty->left_delimiter = C('template-left_delimiter'); //左分界符,2.0属性,3.0沿用 $this->smarty->right_delimiter = C('template-right_delimiter'); $mod = $GLOBALS['_Module']; //$this->smarty->setTemplateDir(APP_TPL.'Index'); //设置编译目录路径,不设默认"templates_c" $this->smarty->setCompileDir(RUNTIME_CACHE . $mod . DS); //设置配置目录路径,不设默认"configs" $this->smarty->setConfigDir(APP_PATH . APP_NAME . DS . 'Conf' . DS); //设置新的cache缓存目录 $this->smarty->setCacheDir(RUNTIME_DATA . $mod . DS); unset($mod); } }
/** * @see PKPHandler::initialize() */ function initialize(&$request) { // Add checkbox column to the grid. import('controllers.grid.files.fileList.FileSelectionGridColumn'); $this->addColumn(new FileSelectionGridColumn($this->getSelectName())); parent::initialize($request); }
function importVersion($filename) { import('lib.pkp.classes.rt.RTXMLParser'); $parser = new RTXMLParser(); $version =& $parser->parse($filename); $this->dao->insertVersion($this->archiveId, $version); }
/** * Display a single Completed payment */ function viewPayment($args, $request) { $this->validate(); $this->setupTemplate($request); import('classes.payment.ojs.OJSPaymentAction'); OJSPaymentAction::viewPayment($args, $request); }
public function getList($where = array(), $order = false, $limit = false, $page = false, $group = false) { $data = array(); if ($page) { import('ORG.Util.Page'); $count = $this->where($where)->count(); $limit = $limit ? $limit : 10; $Page = new Page($count, $limit); $data['page'] = $Page->show(); if ($group) { $this->group($group); } if ($order) { $this->order($order); } $this->limit($Page->firstRow . ',' . $Page->listRows); $data['list'] = $this->where($where)->select(); } else { if ($limit) { $this->limit($limit); } if ($group) { $this->group($group); } if ($order) { $this->order($order); } $data = $this->where($where)->select(); } return $data; }
/** * Show the form to allow the user to select files from previous stages * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function selectFiles($args, $request) { import('lib.pkp.controllers.grid.files.final.form.ManageFinalDraftFilesForm'); $manageFinalDraftFilesForm = new ManageFinalDraftFilesForm($this->getSubmission()->getId()); $manageFinalDraftFilesForm->initData($args, $request); return new JSONMessage(true, $manageFinalDraftFilesForm->fetch($request)); }
public function sysmsg($re = false) { $map['uid'] = $this->uid; //分页处理 import("ORG.Util.Page"); $count = M('inner_msg')->where($map)->count('id'); $p = new Page($count, 15); $page = $p->show(); $Lsql = "{$p->firstRow},{$p->listRows}"; //分页处理 $list = M('inner_msg')->where($map)->order('id DESC')->limit($Lsql)->select(); $read = M("inner_msg")->where("uid={$this->uid} AND status=1")->count('id'); $this->assign("list", $list); $this->assign("pagebar", $page); $this->assign("read", $read); $this->assign("unread", $count - $read); $this->assign("count", $count); if (true === $re) { $dpage = array(); $dpage['numpage'] = $count ? ceil($count / 15) : 1; $dpage['curpage'] = (int) $_GET['p'] ? (int) $_GET['p'] : 1; $this->assign("dpage", $dpage); return $list; } $data['html'] = $this->fetch(); exit(json_encode($data)); }
function verify() { //导入验证码类 import('ORG.Util.Image'); //输出产生验证码 Image::buildImageVerify(); }
/** * Process payment form for buying a gift subscription * @param $args array * @param $request PKPRequest */ function payPurchaseGiftSubscription($args, $request) { $journal = $request->getJournal(); if (!$journal) { $request->redirect(null, 'index'); } import('classes.payment.ojs.OJSPaymentManager'); $paymentManager = new OJSPaymentManager($request); $acceptSubscriptionPayments = $paymentManager->acceptGiftSubscriptionPayments(); if (!$acceptSubscriptionPayments) { $request->redirect(null, 'index'); } $this->setupTemplate(); $user = $request->getUser(); // If buyer is logged in, save buyer user id as part of gift details if ($user) { $buyerUserId = $user->getId(); } else { $buyerUserId = null; } import('classes.subscription.form.GiftIndividualSubscriptionForm'); $giftSubscriptionForm = new GiftIndividualSubscriptionForm($buyerUserId); $giftSubscriptionForm->readInputData(); if ($giftSubscriptionForm->validate()) { $giftSubscriptionForm->execute(); } else { $giftSubscriptionForm->display(); } }
/** * @copydoc GridRow::initialize() */ function initialize($request, $template = null) { parent::initialize($request, $template); // Is this a new row or an existing row? $plugin =& $this->getData(); /* @var $plugin Plugin */ assert(is_a($plugin, 'Plugin')); $rowId = $this->getId(); // Only add row actions if this is an existing row if (!is_null($rowId)) { $router = $request->getRouter(); /* @var $router PKPRouter */ $actionArgs = array_merge(array('plugin' => $plugin->getName()), $this->getRequestArgs()); if ($this->_canEdit($plugin)) { foreach ($plugin->getActions($request, $actionArgs) as $action) { $this->addAction($action); } } // Administrative functions. if (in_array(ROLE_ID_SITE_ADMIN, $this->_userRoles)) { import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal'); $this->addAction(new LinkAction('delete', new RemoteActionConfirmationModal(__('manager.plugins.deleteConfirm'), __('common.delete'), $router->url($request, null, null, 'deletePlugin', null, $actionArgs), 'modal_delete'), __('common.delete'), 'delete')); $this->addAction(new LinkAction('upgrade', new AjaxModal($router->url($request, null, null, 'upgradePlugin', null, $actionArgs), __('manager.plugins.upgrade'), 'modal_upgrade'), __('grid.action.upgrade'), 'upgrade')); } } }
public function index() { if (!USER_LOGINED) { jump(U('Public/login')); } global $member; import('@.ORG.Page'); $status = $this->_get('status', false); $status = empty($status) ? 0 : $status; if ($status == 0) { $map['arcrank'] = array('in', '1,2,3'); } elseif ($status == 1) { $map['arcrank'] = array('in', '4'); } $map['mid'] = $member['id']; $model = D('ArchiveView'); $count = $model->where($map)->count(); $fenye = 20; $p = new Page($count, $fenye); $list = $model->field('litpic,id,typeid,modelid,arcrank,title,flag,color,click,pubdate,mid,username,description')->where($map)->limit($p->firstRow . ',' . $p->listRows)->order('pubdate desc')->select(); $p->setConfig('prev', '上一页'); $p->setConfig('header', '条记录'); $p->setConfig('first', '首 页'); $p->setConfig('last', '末 页'); $p->setConfig('next', '下一页'); $p->setConfig('theme', "%first%%upPage%%linkPage%%downPage%%end%<li><span>共<font color='#009900'><b>%totalRow%</b></font>条记录 " . $fenye . "条/每页</span></li>\n"); $this->assign('page', $p->show()); $this->assign('list', $list); $this->display(); }
public function index() { parent::userauth2(60); $sid = I('get.sid', ''); $menu = D('Dmenu'); import('ORG.Util.Page'); // 导入分页类 if ($sid != '') { $where['Sid'] = $sid; } else { $where['Sid'] = 0; } $count = $menu->where($where)->count(); //总记录数 $Page = new Page($count, 15); //实例化分页类 传入总记录数和每页显示的记录数 $Page->setConfig('header', '条记录'); $Page->setConfig('prev', '<img src="__IMAGE__/prev.gif" border="0" title="上一页" />'); $Page->setConfig('next', '<img src="__IMAGE__/next.gif" border="0" title="下一页" />'); $Page->setConfig('first', '<img src="__IMAGE__/first.gif" border="0" title="第一页" />'); $Page->setConfig('last', '<img src="__IMAGE__/last.gif" border="0" title="最后一页" />'); $show = $Page->show(); //分页显示输出 $volist = $menu->relation(true)->where($where)->order('Sortid asc')->limit($Page->firstRow . ',' . $Page->listRows)->select(); $list = $menu->where('Sid = 0')->order('Sortid asc')->select(); $this->assign('volist', $volist); $this->assign('list', $list); $this->assign('sid', $sid); $this->assign('page', $show); //输出分页 $this->co = $count; $this->display('System/dmenu'); }
function display(&$args, $request) { $templateMgr =& TemplateManager::getManager(); parent::display($args, $request); $issueDao =& DAORegistry::getDAO('IssueDAO'); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $articleGalleyDao =& DAORegistry::getDAO('ArticleGalleyDAO'); $journal =& Request::getJournal(); switch (array_shift($args)) { case 'exportGalley': $articleId = array_shift($args); $galleyId = array_shift($args); $article =& $publishedArticleDao->getPublishedArticleByArticleId($articleId); $galley =& $articleGalleyDao->getGalley($galleyId, $articleId); if ($article && $galley && ($issue =& $issueDao->getIssueById($article->getIssueId(), $journal->getId()))) { $this->exportArticle($journal, $issue, $article, $galley); break; } default: // Display a list of articles for export $this->setBreadcrumbs(); AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $rangeInfo = Handler::getRangeInfo('articles'); $articleIds = $publishedArticleDao->getPublishedArticleIdsAlphabetizedByJournal($journal->getId(), false); $totalArticles = count($articleIds); $articleIds = array_slice($articleIds, $rangeInfo->getCount() * ($rangeInfo->getPage() - 1), $rangeInfo->getCount()); import('lib.pkp.classes.core.VirtualArrayIterator'); $iterator = new VirtualArrayIterator(ArticleSearch::formatResults($articleIds), $totalArticles, $rangeInfo->getPage(), $rangeInfo->getCount()); $templateMgr->assign_by_ref('articles', $iterator); $templateMgr->display($this->getTemplatePath() . 'index.tpl'); break; } }
function index() { $group_id = isset($_GET['group_id']) && intval($_GET['group_id']) ? intval($_GET['group_id']) : ''; $keyword = isset($_GET['keyword']) && trim($_GET['keyword']) ? trim($_GET['keyword']) : ''; $where = '1=1'; if ($group_id != '') { $where .= " AND group_id={$group_id}"; } if ($keyword != '') { $where .= " AND module like '%{$keyword}%' or module_name like '%{$keyword}%' or action_name like '%{$keyword}%'"; } $node_mod = D('node'); import("ORG.Util.Page"); $count = $node_mod->where($where)->count(); $p = new Page($count, 15); $node_list = $node_mod->where($where)->limit($p->firstRow . ',' . $p->listRows)->order('module asc,sort ASC')->select(); $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=Node&a=add\', title:\'添加菜单\', width:\'500\', height:\'490\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', '添加菜单'); $page = $p->show(); $group_mod = D('group'); $group_list = $group_mod->select(); $this->assign('group_list', $group_list); $this->assign('group_id', $group_id); $this->assign('keyword', $keyword); $this->assign('page', $page); $this->assign('big_menu', $big_menu); $this->assign('node_list', $node_list); $this->display(); }