本文整理汇总了PHP中Publication类的典型用法代码示例。如果您正苦于以下问题:PHP Publication类的具体用法?PHP Publication怎么用?PHP Publication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Publication类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: require_once
require_once($GLOBALS['g_campsiteDir']."/classes/Country.php");
if (!SecurityToken::isValid()) {
camp_html_display_error(getGS('Invalid security token!'));
exit;
}
// Check permissions
if (!$g_user->hasPermission('ManagePub')) {
camp_html_display_error(getGS("You do not have the right to manage publications."));
exit;
}
$Pub = Input::Get('Pub', 'int', 0);
$Language = Input::Get('Language', 'int', 1, true);
$CountryCode = Input::Get('CountryCode');
if (!Input::IsValid()) {
camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), $_SERVER['REQUEST_URI']);
exit;
}
$publicationObj = new Publication($Pub);
$defaultTime = new SubscriptionDefaultTime($CountryCode, $Pub);
$defaultTime->delete();
$logtext = getGS('Subscription default time for "$1":$2 deleted', $publicationObj->getName(), $CountryCode);
Log::Message($logtext, $g_user->getUserId(), 5);
camp_html_add_msg(getGS("Country subscription settings deleted."), "ok");
camp_html_goto_page("/$ADMIN/pub/deftime.php?Pub=$Pub&Language=$Language");
?>
开发者ID:nistormihai,项目名称:Newscoop,代码行数:31,代码来源:do_deldeftime.php
示例2: GetURL
public static function GetURL($p_publicationId, $p_languageId = null, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = NULL, $p_port = null)
{
global $g_ado_db;
global $_SERVER;
if (is_null($p_port)) {
if (!isset($_SERVER['SERVER_PORT'])) {
$_SERVER['SERVER_PORT'] = 80;
}
$p_port = $_SERVER['SERVER_PORT'];
}
$publicationObj = new Publication($p_publicationId);
if (!$publicationObj->exists()) {
return new PEAR_Error(getGS('Publication does not exist.'));
}
if (!isset($p_languageId)) {
$p_languageId = $publicationObj->getDefaultLanguageId();
}
$scheme = $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
$defaultAlias = new Alias($publicationObj->getDefaultAliasId());
$uri = ShortURL::GetURI($p_publicationId, $p_languageId, $p_issueNo, $p_sectionNo, $p_articleNo);
if (!is_string($uri) && PEAR::isError($uri)) {
return $uri;
}
return $scheme . $defaultAlias->getName() . $uri;
}
开发者ID:nidzix,项目名称:Newscoop,代码行数:25,代码来源:ShortURL.php
示例3: camp_is_alias_conflicting
/**
* Check if the alias given is already in use. If so, a user error message
* is created.
*
* @param mixed $p_alias
* Can be a string or an int.
* @return void
*/
function camp_is_alias_conflicting($p_alias)
{
global $ADMIN;
$translator = \Zend_Registry::get('container')->getService('translator');
if (!is_numeric($p_alias)) {
// The alias given is a name, which means it doesnt exist yet.
// Check if the name conflicts with any existing alias names.
$aliases = Alias::GetAliases(null, null, $p_alias);
$alias = array_pop($aliases);
if ($alias) {
$pubId = $alias->getPublicationId();
$pubObj = new Publication($pubId);
$pubLink = "<A HREF=\"/{$ADMIN}/pub/edit.php?Pub={$pubId}\">" . $pubObj->getName() . "</A>";
$msg = $translator->trans("The publication alias you specified conflicts with publication '\$1'.", array('$1' => $pubLink), 'pub');
camp_html_add_msg($msg);
}
} else {
// The alias given is a number, which means it already exists.
// Check if the alias ID is already in use by another publication.
$aliases = Alias::GetAliases($p_alias);
$alias = array_pop($aliases);
if ($alias) {
$pubs = Publication::GetPublications(null, $alias->getId());
if (count($pubs) > 0) {
$pubObj = array_pop($pubs);
$pubLink = "<A HREF=\"/{$ADMIN}/pub/edit.php?Pub=" . $pubObj->getPublicationId() . '">' . $pubObj->getName() . "</A>";
$msg = $translator->trans("The publication alias you specified conflicts with publication '\$1'.", array('$1' => $pubLink), 'pub');
camp_html_add_msg($msg);
}
}
}
}
开发者ID:sourcefabric,项目名称:newscoop,代码行数:40,代码来源:pub_common.php
示例4: takeAction
/**
* Performs the action; returns true on success, false on error.
*
* @param $p_context - the current context object
* @return bool
*/
public function takeAction(CampContext &$p_context)
{
$p_context->default_url->reset_parameter('f_'.$this->m_name);
$p_context->url->reset_parameter('f_'.$this->m_name);
if (!is_null($this->m_error)) {
return false;
}
// Check that the article exists.
$articleMetaObj = $p_context->default_article;
if (!$articleMetaObj->defined) {
$this->m_error = new PEAR_Error('The article was not selected. You must view an article in order to post comments.',
ACTION_PREVIEW_COMMENT_ERR_NO_ARTICLE);
return false;
}
if (!$articleMetaObj->comments_enabled || $articleMetaObj->comments_locked) {
$this->m_error = new PEAR_Error('Comments are not enabled for this publication/article.',
ACTION_PREVIEW_COMMENT_ERR_NOT_ENABLED);
return false;
}
// Get the publication.
$publicationObj = new Publication($articleMetaObj->publication->identifier);
$forum = new Phorum_forum($publicationObj->getForumId());
if (!$forum->exists()) {
$forum->create();
$forum->setName($publicationObj->getName());
$publicationObj->setForumId($forum->getForumId());
}
$forumId = $forum->getForumId();
$user = $p_context->user;
if ($user->defined) {
$this->m_properties['reader_email'] = $user->email;
} else {
if ($forum->getPublicPermissions() & (PHORUM_USER_ALLOW_NEW_TOPIC | PHORUM_USER_ALLOW_REPLY)) {
if (!isset($this->m_properties['reader_email'])) {
$this->m_error = new PEAR_Error('EMail field is empty. You must fill in your EMail address.',
ACTION_PREVIEW_COMMENT_ERR_NO_EMAIL);
return false;
}
} else {
$this->m_error = new PEAR_Error('You must be a registered user in order to submit a comment. Please subscribe or log in if you already have a subscription.',
ACTION_PREVIEW_COMMENT_ERR_NO_PUBLIC);
return false;
}
}
// Check if the reader was banned from posting comments.
if (Phorum_user::IsBanned($userRealName, $userEmail)) {
$this->m_error = new PEAR_Error('You are banned from submitting comments.',
ACTION_PREVIEW_COMMENT_ERR_BANNED);
return false;
}
$this->m_error = ACTION_OK;
return true;
}
开发者ID:nistormihai,项目名称:Newscoop,代码行数:65,代码来源:MetaActionPreview_Comment.php
示例5: camp_forum_create
/**
* Create a forum for a publication.
*
* @param Publication $p_publicationObj
* @return Phorum_forum
*/
function camp_forum_create($p_publicationObj)
{
// create the phorum
$forum = new Phorum_forum();
$forum->create();
$p_publicationObj->setForumId($forum->getForumId());
return $forum;
} // fn camp_forum_create
开发者ID:nistormihai,项目名称:Newscoop,代码行数:14,代码来源:pub_common.php
示例6: create
/**
* @param array $p_values
* @return boolean
*/
public function create($p_values = null)
{
$success = parent::create($p_values);
$publicationObj = new Publication($this->m_data['IdPublication']);
if (function_exists("camp_load_translation_strings")) {
camp_load_translation_strings("api");
}
$logtext = getGS('The default subscription time for ($1 "$2":$3) has been added.', getGS("Publication"), $publicationObj->getName(), $this->m_data['CountryCode']);
Log::Message($logtext, null, 4);
return $success;
} // fn create
开发者ID:nistormihai,项目名称:Newscoop,代码行数:15,代码来源:SubscriptionDefaultTime.php
示例7: view
public function view($issue_id)
{
$this->load->model(['Issue', 'Publication']);
$issue = new Issue();
$issue->load($issue_id);
if (!$issue->issue_id) {
show_404();
}
$publication = new Publication();
$publication->load($issue->publication_id);
$this->load->view('bootstrap/main', ['main' => 'magazines/magazine', 'issue' => $issue, 'publication' => $publication]);
}
开发者ID:TraianAlex,项目名称:ci31,代码行数:12,代码来源:magazine.php
示例8: delete
public function delete(Publication $publication)
{
$table = $publication->getTableName();
$statement = "DELETE FROM {$table} WHERE id = :id LIMIT 1";
$query = $this->session->prepare($statement);
$query->bindParam(":id", $publication->id());
try {
$query->execute();
return $query->rowCount() > 0;
} catch (PDOException $err) {
throw new PDOException($err->getMessage());
}
}
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:13,代码来源:PublicationDao.php
示例9: getPublicationsLink
/**
* Returns the link for given publication and given service.
*
* @param Publication $publication The publication
* @param string $service The service
*
* @return string
*/
public static function getPublicationsLink(Publication $publication, $service)
{
switch ($service) {
case 'Google Scholar':
return 'http://scholar.google.com/scholar?q=allintitle:' . urlencode($publication->getTitle());
break;
case 'BASE':
return 'http://www.base-search.net/Search/Results?lookfor=tit:' . urlencode($publication->getTitle());
break;
default:
return 'unknown service!';
break;
}
}
开发者ID:arkuuu,项目名称:publin,代码行数:22,代码来源:BibLink.php
示例10: Analyse
public function Analyse($title, Subarea $subarea = null, State $state = null, $date = null)
{
$this->name_table = "analysis";
parent::Publication($title, $subarea, $state, $date);
$this->comments = new ArrayObject();
$this->setLink(StringManager::removeSpecialChars($title));
}
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:7,代码来源:Analyse.php
示例11: smarty_function_set_publication
/**
* Campsite set_publication function plugin
*
* Type: function
* Name: set_publication
* Purpose:
*
* @param array
* $p_params[name] The Name of the publication to be set
* $p_params[identifier] The Identifier of the publication to be set
* @param object
* $p_smarty The Smarty object
*/
function smarty_function_set_publication($p_params, &$p_smarty)
{
// gets the context variable
$campsite = $p_smarty->getTemplateVars('gimme');
if (isset($p_params['identifier'])) {
$attrName = 'identifier';
$attrValue = $p_params['identifier'];
$publicationId = intval($p_params['identifier']);
} elseif (isset($p_params['name'])) {
$attrName = 'name';
$attrValue = $p_params['name'];
$publications = Publication::GetPublications($p_params['name']);
if (!empty($publications)) {
$publicationId = $publications[0]->getPublicationId();
} else {
$campsite->publication->trigger_invalid_value_error($attrName, $attrValue, $p_smarty);
return false;
}
} else {
$property = array_shift(array_keys($p_params));
CampTemplate::singleton()->trigger_error("invalid parameter '{$property}' in set_publication");
return false;
}
if ($campsite->publication->defined && $campsite->publication->identifier == $publicationId) {
return;
}
$publicationObj = new MetaPublication($publicationId);
if ($publicationObj->defined) {
$campsite->publication = $publicationObj;
} else {
$campsite->publication->trigger_invalid_value_error($attrName, $attrValue, $p_smarty);
}
}
开发者ID:nidzix,项目名称:Newscoop,代码行数:46,代码来源:function.set_publication.php
示例12: loadModel
public function loadModel($id)
{
if (($model = Publication::model()->findByPk($id)) === null) {
throw new CHttpException(404, Yii::t('PublicationModule.publication', 'Page was not found!'));
}
return $model;
}
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:7,代码来源:PublicationBackendController.php
示例13: onGenerate
/**
* @param Event $event
*/
public static function onGenerate(Event $event)
{
$generator = $event->getGenerator();
$provider = new CActiveDataProvider(Publication::model()->published());
foreach (new CDataProviderIterator($provider) as $item) {
$generator->addItem(Yii::app()->createAbsoluteUrl('/news/news/view', ['alias' => $item->alias]), strtotime($item->update_time), SitemapHelper::FREQUENCY_WEEKLY, 0.5);
}
}
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:11,代码来源:PublicationSitemapGeneratorListener.php
示例14: Paper
public function Paper($title, SubArea $subarea = null, File $file = null, State $state = null, $date = null, $event = null, PublicationType $type = null, $year = null)
{
$this->name_table = "paper";
parent::Publication($title, $subarea, $state, $date);
$this->file = $file;
$this->event = $event;
$this->type = $type;
$this->year = $year;
}
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:9,代码来源:Paper.php
示例15: actionView
public function actionView($alias)
{
$model = Publication::model()->published()->with('user')->findByAlias($alias);
if (is_null($model)) {
throw new CHttpException(404);
}
$this->currentCategory = !empty($model->categories) ? $model->categories[0] : null;
$this->render('view', ['model' => $model]);
}
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:9,代码来源:PublicationController.php
示例16: takeAction
/**
* Performs the action; returns true on success, false on error.
*
* @param $p_context - the current context object
* @return bool
*/
public function takeAction(CampContext &$p_context)
{
$p_context->default_url->reset_parameter('f_' . $this->m_name);
$p_context->url->reset_parameter('f_' . $this->m_name);
if (!is_null($this->m_error)) {
return false;
}
// Check that the article exists.
$articleMetaObj = $p_context->default_article;
if (!$articleMetaObj->defined) {
$this->m_error = new PEAR_Error('The article was not selected. You must view an article in order to post comments.', ACTION_PREVIEW_COMMENT_ERR_NO_ARTICLE);
return false;
}
if (!$articleMetaObj->comments_enabled || $articleMetaObj->comments_locked) {
$this->m_error = new PEAR_Error('Comments are not enabled for this publication/article.', ACTION_PREVIEW_COMMENT_ERR_NOT_ENABLED);
return false;
}
// Get the publication.
$publicationObj = new Publication($articleMetaObj->publication->identifier);
$user = $p_context->user;
if ($user->defined) {
$this->m_properties['reader_email'] = $user->email;
} else {
if (!isset($this->m_properties['reader_email'])) {
$this->m_error = new PEAR_Error('You must be a registered user in order to submit a comment. Please subscribe or log in if you already have a subscription.', ACTION_SUBMIT_COMMENT_ERR_NO_PUBLIC);
return false;
}
if (!$publicationObj->getPublicComments()) {
$this->m_error = new PEAR_Error('EMail field is empty. You must fill in your EMail address.', ACTION_SUBMIT_COMMENT_ERR_NO_EMAIL);
return false;
}
}
// Check if the reader was banned from posting comments.
global $controller;
$repositoryAcceptance = $controller->getHelper('entity')->getRepository('Newscoop\\Entity\\Comment\\Acceptance');
$repository = $controller->getHelper('entity')->getRepository('Newscoop\\Entity\\Comment');
if ($repositoryAcceptance->checkParamsBanned($userRealName, $userEmail, $userIp, $publication_id)) {
$this->m_error = new PEAR_Error('You are banned from submitting comments.', ACTION_SUBMIT_COMMENT_ERR_BANNED);
return false;
}
$this->m_error = ACTION_OK;
return true;
}
开发者ID:nidzix,项目名称:Newscoop,代码行数:49,代码来源:MetaActionPreview_Comment.php
示例17: executeAdd
public function executeAdd(sfWebRequest $request)
{
$pubName = $request->getParameter("name");
$pubId = $request->getParameter("id", null);
if (!is_null($pubId)) {
$pub = PublicationPeer::retrieveByPk($pubId);
} else {
$pub = new Publication();
}
$pub->setName($pubName);
$pub->save();
$c = new Criteria();
$c->addAscendingOrderByColumn(PublicationPeer::NAME);
$pager = new sfPropelPager("Publication", sfConfig::get("app_items_per_page"));
$pager->setCriteria($c);
$pager->setPage(1);
$pager->init();
$this->renderPartial("renderList", array("pager" => $pager));
return sfView::NONE;
}
开发者ID:adatta02,项目名称:comp190-code,代码行数:20,代码来源:actions.class.php
示例18: run
public function run()
{
if ($this->title === false) {
$this->title = Yii::t('PublicationModule.publication', 'News');
}
$criteria = new CDbCriteria();
if ($this->limit > 0) {
$criteria->limit = (int) $this->limit;
}
$models = Publication::model()->sortByDate('DESC')->published()->onMainPage()->findAll($criteria);
$this->render($this->view, ['models' => $models, 'title' => $this->title]);
}
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:12,代码来源:LastPublicationsWidget.php
示例19: index
/**
* Index page for Magazine controller.
*/
public function index() {
/*// echo '<h2>My magazines</h2>';
$this->load->model('Publication');
$this->Publication->publication_name = 'Sandy Shore'; // create the record
$this->Publication->save();
// print_r($this->Publication);
echo '<tt><pre>' . var_export($this->Publication,TRUE) . '<pre><tt>';
$this->load->model('Issue');
$issue = new Issue();
$issue->publication_id = $this->Publication->publication_id;
$issue->issue_number = 2;
$issue->issue_date_publication = date('2015-02-01');
$issue->save();
echo '<tt><pre>' . var_export($issue,TRUE) . '<pre><tt>';
$this->load->view('magazines');
// $this->load->view('magazines');*/
$data = array();
$this->load->model('Publication');
$publication = new Publication();
$publication->load(2);
$data['publication'] = $publication;
$this->load->model('Issue');
$issue = new Issue();
$issue->load(2);
$data['issue'] = $issue;
$this->load->view('magazines');
$this->load->view('magazine',$data);
// echo "<pre>";
// echo print_r($data);
// echo "</pre>";
}
开发者ID:hasanmbstu13,项目名称:Codeigniter,代码行数:42,代码来源:magazine.php
示例20: findSingle
/**
* @param bool $full
*
* @return Publication|false
*/
public function findSingle($full = false)
{
$result = parent::findSingle();
if ($result) {
$publication = new Publication($result);
$repo = new AuthorRepository($this->db);
$publication->setAuthors($repo->where('publication_id', '=', $publication->getId())->order('priority', 'ASC')->find());
$repo = new FileRepository($this->db);
$publication->setFiles($repo->where('publication_id', '=', $publication->getId())->find());
$repo = new UrlRepository($this->db);
$publication->setUrls($repo->where('publication_id', '=', $publication->getId())->find());
if ($full === true) {
$repo = new KeywordRepository($this->db);
$publication->setKeywords($repo->where('publication_id', '=', $publication->getId())->order('name', 'ASC')->find());
$repo = new CitationRepository($this->db);
$publication->setCitations($repo->where('publication_id', '=', $publication->getId())->find());
}
return $publication;
} else {
return false;
}
}
开发者ID:arkuuu,项目名称:publin,代码行数:27,代码来源:PublicationRepository.php
注:本文中的Publication类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论