本文整理汇总了PHP中import函数的典型用法代码示例。如果您正苦于以下问题:PHP import函数的具体用法?PHP import怎么用?PHP import使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了import函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authorize
/**
* @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);
}
示例2: uploadProfileImage
/**
* 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;
}
示例3: __construct
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']));
}
示例4: viewBookForReview
/**
* 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');
}
示例5: submission
/**
* 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');
}
示例6: addTinyMCE
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);
}
示例7: orderSave
/**
* 保存申请单
*
* @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;
}
示例8: _upload
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 ('上传成功!');
}
}
示例9: saveProgramSettings
/**
* 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();
}
}
示例10: sendEmail
protected function sendEmail($smtpemailto, $mailsubject, $text)
{
import("ORG.Util.Smtp");
$smtpserver = "smtp.126.com";
//SMTP服务器
$smtpserverport = 25;
//SMTP服务器端口
$smtpusermail = "tianyu0915@126.com";
//SMTP服务器的用户邮箱
//$smtpemailto = "tianyu0915@gmail.com";//发送给谁
$smtpuser = "tianyu0915";
//SMTP服务器的用户帐号
$smtppass = "122126382";
//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;
}
示例11: Help
/**
* Constructor.
*/
function Help()
{
parent::PKPHelp();
import('classes.help.OJSHelpMappingFile');
$mainMappingFile = new OJSHelpMappingFile();
$this->addMappingFile($mainMappingFile);
}
示例12: gridInitialize
/**
* @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()));
}
示例13: publist
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();
// 输出模板
}
示例14: querylogbytime
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');
}
示例15: displayPaymentForm
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();
}
}