本文整理汇总了PHP中Period::getCurrentPeriod方法的典型用法代码示例。如果您正苦于以下问题:PHP Period::getCurrentPeriod方法的具体用法?PHP Period::getCurrentPeriod怎么用?PHP Period::getCurrentPeriod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Period
的用法示例。
在下文中一共展示了Period::getCurrentPeriod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getR2RPercent
/**
* Return R2R percent
*
* @return int
*/
public static function getR2RPercent()
{
/*
$option = SettingTable::getOptionByName('percent_r2r');
return (int)$option->getValue();
*/
return (double) Period::getCurrentPeriod()->getR2rShare();
}
示例2: setPositions
public static function setPositions()
{
$q = Doctrine_Query::create()->select('v.*')->from('Vote v')->where('v.id_period = ?', Period::getCurrentPeriod()->getId())->orderBy('v.weight DESC');
$votes = $q->execute();
$k = 1;
foreach ($votes as $i => $vote) {
$k += $i;
$vote->setPosition($k);
$vote->save();
}
}
示例3: executeVisit
/**
* Show Visit stats
*
* @param sfWebRequest $request
*/
public function executeVisit(sfWebRequest $request)
{
$this->form = new CategorySelectForm();
$iCategoryId = 1;
$iPeriodId = Period::getCurrentPeriod()->getId();
if ($request->getParameter('category', false)) {
$this->form->bind($request->getParameter($this->form->getName()));
$iCategoryId = $this->form->getValue('id_category');
$this->form->setDefault('id_category', $iCategoryId);
}
$this->aFullData = StatisticsTable::getInstance()->getFullStatistics($iPeriodId);
$this->aDataByCategory = StatisticsTable::getInstance()->getFullStatistics($iPeriodId, $iCategoryId);
}
示例4: getByUserIdAndPeriodId
/**
* Enter description here...
*
* @param int $user_id
* @param int $period_id
* @return BalanceUser
*/
public static function getByUserIdAndPeriodId($user_id, $period_id = 0)
{
if ($period_id == 0) {
$period_id = Period::getCurrentPeriod()->getId();
}
$q = Doctrine_Query::create()->from('BalanceUser bu')->where('bu.id_user=?', $user_id)->andWhere('bu.id_period=?', $period_id)->limit(1);
$balance = $q->fetchOne();
if (false === $balance) {
BalanceUser::setInitialRecord($user_id, $period_id);
$balance = self::getByUserIdAndPeriodId($user_id, $period_id);
//throw new sfException('Cannot get Balance for User: '.$user_id.' period: '.$period_id.'. Error in DB data');
}
return $balance;
}
示例5: postInsert
public function postInsert($event)
{
$oStatistics = new Statistics();
$oStatistics->setCategoryId($this->getId());
try {
$iPeriod = Period::getCurrentPeriod();
} catch (sfException $e) {
return;
}
if (false !== $iPeriod) {
$oStatistics->setPeriodId($iPeriod);
$oStatistics->save();
}
}
示例6: executeIndex
public function executeIndex(sfWebRequest $request)
{
// sorting
if ($request->getParameter('sort') && $this->isValidSortColumn($request->getParameter('sort'))) {
$this->setSort(array($request->getParameter('sort'), $request->getParameter('sort_type')));
}
// pager
if ($request->getParameter('page')) {
$this->setPage($request->getParameter('page'));
}
$this->pager = $this->getPager();
$this->sort = $this->getSort();
$user = new User();
$this->dataArray = array('amountSum' => $user->getUserAmountSum('uuser', Period::getCurrentPeriod()->getId()), 'sellPurchaseSum' => $user->getUserSellPurchaseSum('uuser', Period::getCurrentPeriod()->getId()));
}
示例7: genMassPayWM
public static function genMassPayWM($pay = true)
{
$max_id = Doctrine_Query::create()->select('max(bu.was_paid_id) as bu_max')->from('BalanceUser bu')->where('bu.was_paid > 0')->execute()->getFirst()->getBuMax();
$q = Doctrine_Query::create()->select("bu.id_user, u.account_number as account_number, sum(bu.payable) as to_pay,\n group_concat(p.date separator '|') as p_date, group_concat(bu.id separator '|') as for_ids")->from('BalanceUser bu')->innerJoin('bu.User u')->innerJoin('bu.Period p')->where('bu.was_paid = 0')->andWhere('bu.payable > 0')->andWhere("u.utype = 'puser'")->andWhere('bu.id_period != ?', Period::getCurrentPeriod()->getId())->groupBy('bu.id_user')->execute();
$min_payout = (double) Setting::getValueByName('minPayout');
$out = array();
$out_num = 0;
foreach ($q as $rec) {
if (preg_match('/^R[0-9]{12}$/', $rec->getAccountNumber()) && $rec->getToPay() >= $min_payout) {
if ($pay === true) {
$max_id = (int) $max_id + 1;
$bu_ids = explode('|', $rec->getForIds());
foreach ($bu_ids as $bu_id) {
$bu = BalanceUserTable::getInstance()->findOneById($bu_id);
$bu->setWasPaidId($max_id);
$bu->save();
}
$per = array();
$per_dates = explode('|', $rec->getPDate());
foreach ($per_dates as $p_date) {
$p_date_t = explode('-', $p_date);
$per[] = $p_date_t[1] . '/' . $p_date_t[0];
}
$row = array();
$row[] = $rec->getAccountNumber();
// номер кошелька
$row[] = $rec->getToPay();
// сумма тут надо разобраться с валютой
$row[] = mb_convert_encoding('Выплата за ', 'cp1251', 'utf-8') . join(', ', $per) . '. read2read.ru, payId:' . $max_id;
// комментарий к выплате
$row[] = $max_id;
// номер платежа
$out[] = join(';', $row);
} else {
$out_num += $rec->getToPay();
}
}
}
if ($pay === true) {
return join(PHP_EOL, $out);
} else {
return (int) $out_num;
}
}
示例8: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
$this->period = Period::getCurrentPeriod();
$this->user = $this->getUSer()->getGuardUser();
$this->form = new UserVoteForm();
if ($this->user->isVoted()) {
$this->redirect('profile_p_vote1k_all');
}
if ($request->getParameter('create-vote') != '') {
if ($this->user->hasVote()->count() == 0) {
if ($this->processForm($request, $this->form)) {
$vote = $this->form->save();
$vote->setUser($this->user);
$vote->setPeriod($this->period);
$vote->setWeight($this->user->getWeight());
$vote->save();
VoteTable::getInstance()->setPositions();
}
}
}
}
示例9: uuserViewCategory
/**
* U_User посмотрел категорию. Учитываем только один заход за день
*
* @param int $iUserId
* @param int $iCategoryId
*/
public static function uuserViewCategory($iUserId = 0, $iCategoryId = 0)
{
$q = Doctrine_Query::create()->select('sc.user_id')->from('StatisticsCategory sc')->where('sc.visit_date = CURDATE()')->andWhere('sc.category_id = ?', $iCategoryId)->andWhere('sc.user_id = ?', $iUserId)->limit(1);
if (false !== $q->fetchOne()) {
return;
}
// No first visit
// New u_user
$oStatsCategory = new StatisticsCategory();
$oStatsCategory->setCategoryId($iCategoryId);
$oStatsCategory->setUserId($iUserId);
$oStatsCategory->setVisitDate(date('Y-m-d'));
$oStatsCategory->save();
// Update category stats
$oStatistics = StatisticsTable::getInstance()->getFullStatistics(Period::getCurrentPeriod(), $iCategoryId);
if (!$oStatistics instanceof Statistics) {
throw new sfException('Cannon get Statistics object');
}
$callMethodGet = 'get' . date('j') . 'Login';
$callMethodSet = 'set' . date('j') . 'Login';
$oStatistics->{$callMethodSet}($oStatistics->{$callMethodGet}() + 1);
$oStatistics->save();
}
示例10: executeLoginForm
/**
* Execute Login Form action
*
* @param sfWebRequest $request
*/
public function executeLoginForm(sfWebRequest $request)
{
$this->form = new LoginForm();
if ($request->isMethod('post') && null !== $request->getParameter($this->form->getName())) {
$this->form->bind($request->getParameter($this->form->getName()));
if ($this->form->isValid()) {
$values = $this->form->getValues();
$this->getUser()->signin($values['user'], true);
$oUser = $this->getUser()->getGuardUser();
if ($oUser->getLastLogin() != date("Y-m-d") && $oUser->getUtype() == 'uuser') {
// statistic writing
// set last login
$oUser->setLastLogin(date("Y-m-d"));
$oUser->save();
// get current statistic raw
$oStatistics = StatisticsTable::getInstance()->getFullStatistics(Period::getCurrentPeriod()->getId());
// update login statistic
$oStatistics->set(date("j") . '_login', $oStatistics->get(date("j") . '_login') + 1);
$oStatistics->save();
}
return $this->getController()->redirect('@homepage');
}
}
}
示例11: __
?>
</a></li>
<li><a href="/task/user"><?php
echo __('Tasks');
?>
</a></li>
<li><?php
echo Period::getCurrentPeriod()->name;
?>
</li>
</ol>
<div class="page-header">
<h3>
<i class="fa fa-tasks"></i> <?php
echo __('Tasks on :period', array(':period' => Period::getCurrentPeriod()->name));
?>
</h3>
</div>
<div class="row">
<div class="col col-md-3">
</div>
<div class="col col-md-12">
<?php
$this->renderPartial('user/tasks', array('model' => $model));
?>
</div>
</div>
示例12: userTasksForCurrentPeriod
public function userTasksForCurrentPeriod(User $user)
{
$criteria = new CDbCriteria();
$criteria->alias = 'job';
$criteria->select = 'task.user_id as task_user_id, task.name as name, task.number as number, task.priority as priority, user.name as user_name, job.*';
$criteria->join = 'LEFT JOIN ' . Task::model()->tableName() . ' on task.id = job.task_id
LEFT JOIN ' . User::model()->tableName() . ' on user.id = task.user_id';
$criteria->compare('job.organization_id', $user->organization_id);
$criteria->compare('task.period_id', Period::getCurrentPeriod()->id);
return new CActiveDataProvider(Job::model(), array('criteria' => $criteria, 'sort' => array('defaultOrder' => 'task.period_id DESC, job.status ASC, task.priority DESC', 'route' => "site/usertasks", 'attributes' => array('priority' => array('asc' => 'task.priority', 'desc' => 'task.priority DESC'), 'name' => array('asc' => 'task.name', 'desc' => 'task.name DESC'), 'number' => array('asc' => 'task.number', 'desc' => 'task.number DESC'), 'user_name' => array('asc' => 'user.name', 'desc' => 'user.name DESC'), '*')), 'pagination' => array('pageSize' => 20, 'route' => "site/usertasks")));
}
示例13: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
$this->period = Period::getCurrentPeriod();
$this->stats_nopub = ContentTable::getInstance()->getUserStatsNoPublished($this->getUser()->getId());
// $this->stats_pub = ContentTable::getInstance()->getUserStatsPublished($this->getUser()->getId());
$this->stats_pub = $this->getUser()->getGuardUser()->getSoldStatsForPeriod($this->period);
}
示例14: addFundsFin
public static function addFundsFin(Transaction $transaction)
{
if ($transaction->getIsPaid()) {
// транзакция уже была обработана
return false;
} else {
$transaction->addFundsFin();
}
// set new balance
$user = UserTable::getInstance()->findOneById($transaction->getIdReceiver());
$user->setBalans($transaction->getReceiverBalanceAfter());
$user->save();
$amount = $transaction->getAmount();
// write to BalanceUser instance
if (!($userBalance = BalanceUserTable::getByUserIdAndPeriodId($user->getId()))) {
$userBalance = new BalanceUser();
$userBalance->setPeriod(Period::getCurrentPeriod());
$userBalance->setUser($user);
}
$userBalance->setAddFunds($userBalance->getAddFunds() + $amount);
$userBalance->save();
if (!($systemBalance = BalanceSystem::getCurrentBalanceInstance())) {
sfContext::getInstance()->getLogger()->info('aS4W Error: getCurrentBalanceInstance return false');
return false;
}
if ($user->getUSerTypePrefix() == 'u') {
$systemBalance->setDepositUser($systemBalance->getDepositUser() + $amount);
} else {
switch ($user->getTariff()) {
case 'standart':
$systemBalance->setDepositStandart($systemBalance->getDepositStandart() + $amount);
break;
case 'super':
$systemBalance->setDepositSuper($systemBalance->getDepositSuper() + $amount);
break;
case 'expert':
$systemBalance->setDepositExpert($systemBalance->getDepositExpert() + $amount);
break;
}
}
$systemBalance->save();
// If user blocked try UnBlock
if ($user->is_blocked) {
$user->tryUnBlockUser();
}
return true;
}
示例15: slot
<?php
slot('title_page');
?>
Catalog - Каталог
<?php
end_slot('title_page');
?>
<div id=mdl xmlns="http://www.w3.org/1999/html">
<p>Сайт <span>read2read.ru</span> продает переводы к английским текстам в целях помощи при изучении английского языка. </p>
<p>Сайт содержит 23 раздела , каждый из которых посвящен какому-либо виду человеческой деятельности или стороне жизни. <br>
Кроме переводов, вниманию читателей предлагаются комментарии к отдельным словам, выражениям, сокращениям.</p>
<p>Цена перевода зависит от его объема, который измеряется в тасячах знаков. Считаются все знаки, кроме пробелов. </p>
<p> Стоимость <b>1тысячи</b> знаков = <span><?php
echo number_format(Period::getCurrentPeriod()->get1k(), 2, '.', '');
?>
руб.</span></p>
<table id=items border="0" cellpadding="0" cellspacing="0">
<tr class=bl>
<td>
<p class=le>Title</p>
<p class=ri>Название</p>
<p class=price>Цена</p>
<p class=kzn>Объем</p>
</td>
</tr>
<?php