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


PHP Period类代码示例

本文整理汇总了PHP中Period的典型用法代码示例。如果您正苦于以下问题:PHP Period类的具体用法?PHP Period怎么用?PHP Period使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: scanpassword

 function scanpassword($password)
 {
     $lower = false;
     $upper = false;
     $specialchar = false;
     $number = false;
     $possibilities = 0;
     $special = '!@#$%&*<>-_!@#$%&*<>-_';
     for ($i = 0; $i < strlen($password); $i++) {
         if (preg_match("/[a-z]/", $password[$i]) && !$lower) {
             $possibilities += 26;
             $lower = true;
         }
         if (preg_match('/[A-Z]/', $password[$i]) && !$upper) {
             $possibilities += 26;
             $upper = true;
         }
         if (preg_match('/[0-9]/', $password[$i]) && !$number) {
             $possibilities += 10;
             $number = true;
         }
         if (strpbrk($password[$i], $special) && !$specialchar) {
             $possibilities += 15;
             $specialchar = true;
         }
     }
     $product['product'] = pow($possibilities, strlen($password)) / 4000000000;
     $product['possibilities'] = $possibilities;
     $product['quantity'] = strlen($password);
     $objPeriod = new Period();
     $product['possibilities'] = $objPeriod->mountPossibilities($product);
     return $product;
 }
开发者ID:matheusasdev,项目名称:PowerKey,代码行数:33,代码来源:scan.php

示例2: format

 public function format(Period $period)
 {
     // this method actually has a pretty bad smell on it.
     // it does what it's supposed to, but at one point or another it should be
     // refactored to use a combination of
     // the strategy and chain of responsibility-pattern
     // so the variants can be customized
     if ($period->getYears() != 0) {
         return $this->doFormat($this->lang, 'years', $period->getYears());
     }
     if ($period->getMonths() != 0) {
         return $this->doFormat($this->lang, 'months', $period->getMonths());
     }
     if ($period->getDays() != 0) {
         $amount = $period->getDays();
         // if the amount of days is larger than 6 we'll want to
         // express it in weeks instead
         if ($amount > 6 || $amount < -6) {
             $amount = intval($amount / 7);
             return $this->doFormat($this->lang, 'weeks', $amount);
         } else {
             return $this->doFormat($this->lang, 'days', $amount);
         }
     }
     if ($period->getHours() != 0) {
         return $this->doFormat($this->lang, 'hours', $period->getHours());
     }
     if ($period->getMinutes() != 0) {
         return $this->doFormat($this->lang, 'minutes', $period->getMinutes());
     }
     return $this->doFormat($this->lang, 'justNow', 0);
 }
开发者ID:pago,项目名称:pantr,代码行数:32,代码来源:PeriodFormat.php

示例3: actionIndex

 public function actionIndex()
 {
     $model = new Period('search');
     $model->unsetAttributes();
     if (isset($_GET['Period'])) {
         $model->attributes = $_GET['Period'];
     }
     $this->render('list', array('model' => $model));
 }
开发者ID:nsarvar,项目名称:performance,代码行数:9,代码来源:PeriodController.php

示例4: getVoted1k

 public static function getVoted1k(Period $period)
 {
     $q = Doctrine_Query::create()->select('v.*')->from('Vote v')->where('v.id_period = ?', $period->getId())->andWhere('v.weight > 50')->execute()->getFirst();
     if ($q) {
         return $q->getPrice();
     } else {
         return false;
     }
 }
开发者ID:rollmax,项目名称:read2read,代码行数:9,代码来源:VoteTable.class.php

示例5: getSoldArticlesQuery

 public static function getSoldArticlesQuery(User $user, Period $period, $c_sort = null)
 {
     if (!is_null($c_sort)) {
         $sortby = $c_sort['sortby'];
         $order = $c_sort['order'];
     } else {
         $sortby = 'pub_date';
         $order = 'desc';
     }
     $q = Doctrine_Query::create()->select('c.id, sum(t.amount) as sell_sum, count(cp.id) as sell_count')->from('Content c')->leftJoin('c.Category ct')->leftJoin('c.ContentPurchase cp')->leftJoin('cp.Transaction t with t.id_period = ?', $period->getId())->where('c.id_user = ?', $user->getId())->andWhere('c.state = "public"')->groupBy('c.id')->orderBy("{$sortby} {$order}");
     return $q;
 }
开发者ID:rollmax,项目名称:read2read,代码行数:12,代码来源:ContentTable.class.php

示例6: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $Database = new \mysqli(TEST_DB_HOST, TEST_DB_USER, TEST_DB_PASSWORD, TEST_DB);
     $oPeriod = new Period($Database);
     $oPeriod->setPeriodType('monthly');
     $this->object = new Data($Database, $oPeriod);
     $sSql = "DELETE FROM `dim_l1`";
     $this->object->getDbConnection()->query($sSql);
     $sSql = "DELETE FROM `dim_l2`";
     $this->object->getDbConnection()->query($sSql);
     $sSql = "DELETE FROM `dim_l3`";
     $this->object->getDbConnection()->query($sSql);
     $sSql = "INSERT INTO `dim_table` (`id`, `table_name`) VALUES (" . self::TEST_TABLE_ID . ", 'test_table')";
     $this->object->getDbConnection()->query($sSql);
 }
开发者ID:dbrisinajumi,项目名称:dimensions,代码行数:19,代码来源:DataTest.php

示例7: __construct

 /**
  * This is construct base of the class.
  *
  * A public constructor; initializes the variable $instanceDataBase.
  *
  */
 public function __construct($instanceDataBase)
 {
     parent::__construct($instanceDataBase);
     Period::setDataOperationBusiness($instanceDataBase);
     Period::getBusiness();
     Period::getDescriptionBusiness();
 }
开发者ID:vicholuis,项目名称:proyectopruebalms,代码行数:13,代码来源:Period.php

示例8: getR2RPercent

 /**
  * Return R2R percent
  *
  * @return int
  */
 public static function getR2RPercent()
 {
     /*
     $option = SettingTable::getOptionByName('percent_r2r');
     return (int)$option->getValue();
     */
     return (double) Period::getCurrentPeriod()->getR2rShare();
 }
开发者ID:rollmax,项目名称:read2read,代码行数:13,代码来源:Setting.class.php

示例9: getAllInvoicePeriods

 public function getAllInvoicePeriods()
 {
     // status
     $all_periods = Period::orderBy('id', 'ASC')->get(['id', 'description']);
     $periods = [];
     foreach ($all_periods as $period) {
         $periods[] = (object) ['value' => $period->id, 'label' => utf8_encode($period->description)];
     }
     return $periods;
 }
开发者ID:strikles,项目名称:php,代码行数:10,代码来源:traitGetAll.php

示例10: run

 public function run()
 {
     DB::table('periods')->delete();
     Period::create(array('start' => '8:00', 'end' => '9:30', 'total' => 10, 'current' => 2, 'schedule_id' => 1));
     Period::create(array('start' => '9:30', 'end' => '10:30', 'total' => 10, 'current' => 6, 'schedule_id' => 1));
     Period::create(array('start' => '10:30', 'end' => '12:00', 'total' => 10, 'current' => 0, 'schedule_id' => 1));
     Period::create(array('start' => '13:00', 'end' => '14:30', 'total' => 10, 'current' => 10, 'schedule_id' => 3));
     Period::create(array('start' => '14:30', 'end' => '16:30', 'total' => 10, 'current' => 0, 'schedule_id' => 3));
     Period::create(array('start' => '16:30', 'end' => '18:00', 'total' => 8, 'current' => 3, 'schedule_id' => 3));
 }
开发者ID:Jv-Juven,项目名称:hospital-register-system,代码行数:10,代码来源:PeriodTableSeeder.php

示例11: delete

 /**
  * Delete this period or related object.
  * If no parameters are set, this method deletes current period and re-sort all other periods.
  * @param DataMapper|string $object related object to delete from relation.
  * @param string $related_field relation internal name.
  */
 public function delete($object = '', $related_field = '')
 {
     if (empty($object) && !is_array($object) && !empty($this->id)) {
         $lower_periods = new Period();
         $lower_periods->order_by('sorting', 'asc');
         $lower_periods->where('sorting > ', $this->sorting);
         $lower_periods->get_iterated();
         $ids = array();
         foreach ($lower_periods as $lower_period) {
             $ids[] = $lower_period->id;
         }
         if (count($ids) > 0) {
             $this->db->set('sorting', 'sorting-1', FALSE);
             $this->db->where_in('id', $ids);
             $this->db->update('periods');
         }
     }
     parent::delete($object, $related_field);
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:25,代码来源:period.php

示例12: 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);
 }
开发者ID:rollmax,项目名称:read2read,代码行数:18,代码来源:actions.class.php

示例13: 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;
 }
开发者ID:rollmax,项目名称:read2read,代码行数:21,代码来源:BalanceUserTable.class.php

示例14: 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();
     }
 }
开发者ID:rollmax,项目名称:read2read,代码行数:14,代码来源:Category.class.php

示例15: 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()));
 }
开发者ID:rollmax,项目名称:read2read,代码行数:15,代码来源:actions.class.php


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