当前位置: 首页>>代码示例>>PHP>>正文


PHP Subscription::GetSubscriptions方法代码示例

本文整理汇总了PHP中Subscription::GetSubscriptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Subscription::GetSubscriptions方法的具体用法?PHP Subscription::GetSubscriptions怎么用?PHP Subscription::GetSubscriptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subscription的用法示例。


在下文中一共展示了Subscription::GetSubscriptions方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($publicationId, $userId)
 {
     $this->m_dbObject = Subscription::GetSubscriptions($publicationId, $userId);
     if (count($this->m_dbObject) == 0) {
         $this->m_dbObject = array();
     }
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:7,代码来源:MetaSubscriptions.php

示例2: 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 (PEAR::isError($this->m_error)) {
         return false;
     }
     $auth = Zend_Auth::getInstance();
     $user = new User($p_context->user->identifier);
     if ($user->getUserId() != $auth->getIdentity() || $user->getUserId() == 0) {
         $this->m_error = new PEAR_Error('You must be logged in to create or edit your subscription.', ACTION_EDIT_SUBSCRIPTION_ERR_NO_USER);
         return false;
     }
     $subscriptions = Subscription::GetSubscriptions($p_context->publication->identifier, $user->getUserId());
     if (count($subscriptions) == 0) {
         $subscription = new Subscription();
         $created = $subscription->create(array('IdUser' => $user->getUserId(), 'IdPublication' => $p_context->publication->identifier, 'Active' => 'Y', 'Type' => $this->m_subscriptionType == 'trial' ? 'T' : 'P'));
         if (!$created) {
             $this->m_error = new PEAR_Error('Internal error (code 1)', ACTION_EDIT_SUBSCRIPTION_ERR_INTERNAL);
             exit(1);
         }
     } else {
         $subscription = $subscriptions[0];
     }
     $publication = new Publication($p_context->publication->identifier);
     $subscriptionDays = $this->computeSubscriptionDays($publication, $p_context->publication->subscription_time);
     $startDate = new Date();
     $columns = array('StartDate' => $startDate->getDate(), 'Days' => $subscriptionDays, 'PaidDays' => $this->m_subscriptionType == 'trial' ? $subscriptionDays : 0, 'NoticeSent' => 'N');
     if ($this->m_properties['subs_by_type'] == 'publication') {
         $sectionsList = Section::GetUniqueSections($p_context->publication->identifier);
         foreach ($sectionsList as $section) {
             $this->m_sections[] = $section['id'];
         }
     }
     foreach ($this->m_languages as $languageId) {
         foreach ($this->m_sections as $sectionNumber) {
             $subsSection = new SubscriptionSection($subscription->getSubscriptionId(), $sectionNumber, $languageId);
             $subsSection->create($columns);
         }
     }
     $fields = array('SubsType', 'tx_subs', 'nos', 'unitcost', 'unitcostalllang', 'f_substype', 'cb_subs', 'subs_all_languages', 'suma', 'tpl', 'subscription_language');
     foreach (CampRequest::GetInput() as $field => $value) {
         if (strncmp('tx_subs', $field, strlen('tx_subs')) == 0) {
             $fields[] = $field;
         }
     }
     foreach ($fields as $fieldName) {
         $p_context->default_url->reset_parameter($fieldName);
         $p_context->url->reset_parameter($fieldName);
     }
     $this->m_error = ACTION_OK;
     return true;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:59,代码来源:MetaActionEdit_Subscription.php

示例3: strtok

$f_subscription_type = Input::Get('f_subscription_type', 'string', 'PN');
$f_subscription_days = Input::Get('f_subscription_days', 'int', 0);

if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] != '') {
	$uriPath = strtok($_SERVER['HTTP_REFERER'], "?");
} elseif ($g_user->hasPermission('ManageUsers')) {
	$uriPath = "/$ADMIN/users/edit.php";
} else {
	$uriPath = "/$ADMIN/users/subscriptions";
}
$inSubscriptions = (strstr($uriPath, '/subscriptions') != '')
					|| !$g_user->hasPermission('ManageUsers');

$manageUser = new User($f_user_id);
$publications = Publication::GetPublications();
$subscriptions = Subscription::GetSubscriptions(null, $f_user_id);
if (sizeof($subscriptions) > 0) {
	$subscriptions_ids = array();
	foreach ($subscriptions as $subscription) {
		$subscriptions_ids[] = $subscription->getPublicationId();
	}
	$remaining_publications = array();
	foreach ($publications as $publication) {
		if (!in_array($publication->getPublicationId(), $subscriptions_ids)) {
			$remaining_publications[] = $publication;
		}
	}
	$publications = $remaining_publications;
}

if (sizeof($publications) <= 0) {
开发者ID:nistormihai,项目名称:Newscoop,代码行数:31,代码来源:add.php

示例4: getSubscription

 /**
  * Get subscription
  *
  * @return MetaSubscription
  */
 protected function getSubscription()
 {
     if (empty($this->m_dbObject)) {
         return new MetaSubscription();
     }
     $publicationId = CampTemplate::singleton()->context()->publication->identifier;
     $subscriptions = Subscription::GetSubscriptions($publicationId, $this->m_dbObject->getId());
     return empty($subscriptions) ? new MetaSubscription() : new MetaSubscription($subscriptions[0]->getSubscriptionId());
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:14,代码来源:MetaUser.php

示例5: putGS

if (sizeof($publications) > $numSubscriptions) {
?>
			<td align="right" valign="center" nowrap>
				<?php $addURI = "/$ADMIN/users/subscriptions/add.php?f_user_id=".$editUser->getUserId(); ?>
				<a href="<?php echo $addURI; ?>"><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/add.png" BORDER="0"></A>
				<a href="<?php echo $addURI; ?>"><B><?php putGS("Add new"); ?></B></A>
			</td>
<?php
} // if (sizeof($publications) > $numSubscriptions)
?>
		</tr>
		</table>
	</td>
</tr>
<?php
$subscriptions = Subscription::GetSubscriptions(null, $editUser->getUserId(), array("ORDER BY" => array("Id" => "DESC")));
if (count($subscriptions) > 0) {
	$color=0;
	?>
	<TR class="table_list_header">
		<TD ALIGN="LEFT" VALIGN="TOP" nowrap><B><?php  putGS("Publication"); ?></B></TD>
		<TD ALIGN="LEFT" VALIGN="TOP" nowrap><B><?php  putGS("Left to pay"); ?></B></TD>
		<TD ALIGN="LEFT" VALIGN="TOP" nowrap><B><?php  putGS("Type"); ?></B></TD>
		<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="1%" ><B><?php  putGS("Active"); ?></B></TD>
		<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="1%" ><B><?php  putGS("Delete"); ?></B></TD>
	</TR>
<?php
	foreach ($subscriptions as $subscription) {
		$publicationObj = new Publication($subscription->getPublicationId());
?>	<TR <?php  if ($color) { $color=0; ?>class="list_row_even"<?php  } else { $color=1; ?>class="list_row_odd"<?php  } ?>>
		<TD>
开发者ID:nistormihai,项目名称:Newscoop,代码行数:31,代码来源:subscriptions.php

示例6: require_once

require_once($GLOBALS['g_campsiteDir']. '/classes/Subscription.php');
require_once($GLOBALS['g_campsiteDir']. '/classes/Publication.php');
require_once($GLOBALS['g_campsiteDir']."/db_connect.php");

$f_user_id = Input::Get('f_user_id', 'int', 0);
$f_subscription_offset = Input::Get('f_subscription_offset', 'int', 0, true);
if ($f_subscription_offset < 0) {
	$f_subscription_offset = 0;
}
$ItemsPerPage = 20;
$manageUser = new User($f_user_id);

$publications = Publication::GetPublications();
$numSubscriptions = Subscription::GetNumSubscriptions(null, $f_user_id);
$subscriptions = Subscription::GetSubscriptions(null, $f_user_id,
	array("ORDER BY" => array("Id" => "DESC"),
		  "LIMIT" => array("START" => $f_subscription_offset, "MAX_ROWS" => $ItemsPerPage)));

$crumbs = array();
$crumbs[] = array(getGS('Users'), '');
$crumbs[] = array(getGS('Subscribers'), "/$ADMIN/users/?uType=Subscribers");
$crumbs[] = array(getGS('Account') . " '".$manageUser->getUserName()."'",
			"/$ADMIN/users/edit.php?User=$f_user_id&uType=Subscribers");
$crumbs[] = array(getGS('Subscriptions'), "/$ADMIN/users/subscriptions/?f_user_id=$f_user_id");
echo camp_html_breadcrumbs($crumbs);

if (sizeof($publications) > $numSubscriptions) {
?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons">
<TR>
开发者ID:nistormihai,项目名称:Newscoop,代码行数:31,代码来源:index.php

示例7: camp_html_display_error

<?php

require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/sections/section_common.php";
require_once $GLOBALS['g_campsiteDir'] . '/classes/Article.php';
if (!$g_user->hasPermission('DeleteSection')) {
    camp_html_display_error(getGS('You do not have the right to delete sections.'));
    exit;
}
$f_publication_id = Input::Get('Pub', 'int', 0);
$f_issue_number = Input::Get('Issue', 'int', 0);
$f_language_id = Input::Get('Language', 'int', 0);
$f_section_number = Input::Get('Section', 'int', 0);
$numArticles = count(Article::GetArticles($f_publication_id, $f_issue_number, $f_section_number, $f_language_id));
$numSubscriptions = count(Subscription::GetSubscriptions($f_publication_id));
$publicationObj = new Publication($f_publication_id);
$issueObj = new Issue($f_publication_id, $f_language_id, $f_issue_number);
$sectionObj = new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);
$sectionTranslations = Section::GetSections($f_publication_id, $f_issue_number, null, null, $sectionObj->getName(), null);
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj, 'Section' => $sectionObj);
camp_html_content_top(getGS('Delete section'), $topArray);
?>
<P>
<FORM METHOD="POST" ACTION="/<?php 
echo $ADMIN;
?>
/sections/do_del.php">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<?php 
echo SecurityToken::FormParameter();
?>
<TR>
开发者ID:nidzix,项目名称:Newscoop,代码行数:31,代码来源:del.php


注:本文中的Subscription::GetSubscriptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。