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


PHP BlockInterface::setSetting方法代码示例

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


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

示例1: load

 /**
  * {@inheritdoc}
  */
 public function load(BlockInterface $block)
 {
     $userManager = $this->container->get('fos_user.user_manager');
     $settings = $block->getSettings();
     $userRegistrations = $userManager->fetchRegistrationCount(isset($settings['fetchCountRecord']) ? $settings['fetchCountRecord'] : 5);
     $block->setSetting('userRegistrations', $userRegistrations);
 }
开发者ID:bruery,项目名称:platform,代码行数:10,代码来源:UserRegistrationGraphBlockService.php

示例2: preUpdate

 /**
  * {@inheritdoc}
  */
 public function preUpdate(BlockInterface $block)
 {
     $block->setSetting('galleryId', is_object($block->getSetting('galleryId')) ? $block->getSetting('galleryId')->getId() : null);
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:7,代码来源:GalleryBlockService.php

示例3: load

 /**
  * {@inheritdoc}
  */
 public function load(BlockInterface $block)
 {
     if (is_numeric($block->getSetting('pageId', null))) {
         $cmsManager = $this->cmsManagerSelector->retrieve();
         $site = $block->getPage()->getSite();
         $block->setSetting('pageId', $cmsManager->getPage($site, $block->getSetting('pageId')));
     }
 }
开发者ID:RunOpenCode,项目名称:SonataPageBundle,代码行数:11,代码来源:ChildrenPagesBlockService.php

示例4: load

 /**
  * {@inheritdoc}
  */
 public function load(BlockInterface $block)
 {
     $gender = $this->manager->fetchGenderCount();
     $genderChart = [];
     $genderList = [];
     foreach ($gender as $data) {
         switch ($data['gender']) {
             case 'u':
                 $genderList[] = ['gender' => $this->translator->trans('gender_unknown', [], 'SonataUserBundle'), 'total' => $data['total']];
                 $genderChart[$this->translator->trans('gender_unknown', [], 'SonataUserBundle')] = array($data['total']);
                 break;
             case 'm':
                 $genderList[] = ['gender' => $this->translator->trans('gender_male', [], 'SonataUserBundle'), 'total' => $data['total']];
                 $genderChart[$this->translator->trans('gender_male', [], 'SonataUserBundle')] = array($data['total']);
                 break;
             case 'f':
                 $genderList[] = ['gender' => $this->translator->trans('gender_female', [], 'SonataUserBundle'), 'total' => $data['total']];
                 $genderChart[$this->translator->trans('gender_female', [], 'SonataUserBundle')] = array($data['total']);
                 break;
         }
     }
     $totalGender = $this->manager->fetchGenderCountTotal();
     $block->setSetting('genderList', $genderList);
     $block->setSetting('genderChart', json_encode($genderChart));
     $block->setSetting('genderTotal', $totalGender);
 }
开发者ID:bruery,项目名称:platform,代码行数:29,代码来源:ProfileGenderBlockService.php

示例5: resolveIds

 /**
  * @param BlockInterface $block
  */
 private function resolveIds(BlockInterface $block)
 {
     $block->setSetting('collectionId', is_object($block->getSetting('collectionId')) ? $block->getSetting('collectionId')->getId() : null);
 }
开发者ID:kazak,项目名称:forum,代码行数:7,代码来源:AbstractCollectionsBlockService.php

示例6: load

 /**
  * {@inheritdoc}
  */
 public function load(BlockInterface $block)
 {
     foreach ($block->getTranslations() as $trans) {
         $sharedBlock = $trans->getSetting('blockId', null);
         if (is_int($sharedBlock)) {
             $sharedBlock = $this->blockManager->findOneBy(array('id' => $sharedBlock));
         }
         $trans->setSetting('blockId', $sharedBlock);
     }
     $sharedBlock = $block->getSetting('blockId', null);
     if (is_int($sharedBlock)) {
         $sharedBlock = $this->blockManager->findOneBy(array('id' => $sharedBlock));
     }
     $block->setSetting('blockId', $sharedBlock);
 }
开发者ID:symbio,项目名称:orangegate4-page-bundle,代码行数:18,代码来源:SharedBlockBlockService.php

示例7: load

 /**
  * {@inheritdoc}
  */
 public function load(BlockInterface $block)
 {
     $weekBefore = new \DateInterval('P6D');
     $beginDate = new \DateTime();
     $beginDate->sub($weekBefore);
     $beginDate->setTime(0, 0);
     $endDate = new \DateTime();
     $userLogsByDayGender = $this->manager->fetchUserLogsByDayCountGender($beginDate->format('Y-m-d'), 'login');
     $userLogsByDay = $this->manager->fetchUserLogsByDayCount($beginDate->format('Y-m-d'), 'login');
     $block->setSetting('startDate', $beginDate->format("Y-m-d"));
     $block->setSetting('endDate', $endDate->format("Y-m-d"));
     $interval = new \DateInterval('P1D');
     $daterange = new \DatePeriod($beginDate, $interval, $endDate);
     $dateIndex = [];
     foreach ($daterange as $date) {
         $dateIndex[] = $date->format("Y-m-d");
     }
     $userLogsWeekx = [];
     $userLogsWeekDataU = [];
     $userLogsWeekDataM = [];
     $userLogsWeekDataF = [];
     $userLogsWeekDataTotal = [];
     $userLogsWeekx[] = 'x';
     $userLogsWeekData[] = 'data';
     foreach ($dateIndex as $index => $date) {
         $idx = new \DateTime($date);
         $longIdx = new \DateTime($date);
         $userLogsWeekx[$index] = $idx->format("m-d");
         $userLogsWeekDataU[$index] = "0";
         $userLogsWeekDataM[$index] = "0";
         $userLogsWeekDataF[$index] = "0";
         $userLogsWeekDataTotal[$longIdx->format("F d, Y")]['total'] = "0";
         $userLogsWeekDataTotal[$longIdx->format("F d, Y")]['f'] = "0";
         $userLogsWeekDataTotal[$longIdx->format("F d, Y")]['m'] = "0";
         $userLogsWeekDataTotal[$longIdx->format("F d, Y")]['u'] = "0";
         foreach ($userLogsByDayGender as $key => $log) {
             if ($log['logDate'] === $date) {
                 if ($log['gender'] === 'f') {
                     $userLogsWeekDataTotal[$longIdx->format("F d, Y")]['f'] = $log['logDateCount'];
                     $userLogsWeekDataF[$index] = $log['logDateCount'];
                 } elseif ($log['gender'] === 'm') {
                     $userLogsWeekDataM[$index] = $log['logDateCount'];
                     $userLogsWeekDataTotal[$longIdx->format("F d, Y")]['m'] = $log['logDateCount'];
                 } else {
                     $userLogsWeekDataU[$index] = $log['logDateCount'];
                     $userLogsWeekDataTotal[$longIdx->format("F d, Y")]['u'] = $log['logDateCount'];
                 }
             }
         }
         foreach ($userLogsByDay as $key => $log) {
             if ($log['logDate'] === $date) {
                 $userLogsWeekDataTotal[$longIdx->format("F d, Y")]['total'] = $log['logDateCount'];
             }
         }
     }
     $userLogsWeek['x'] = $userLogsWeekx;
     $userLogsWeek['dataU'] = $userLogsWeekDataU;
     $userLogsWeek['dataM'] = $userLogsWeekDataM;
     $userLogsWeek['dataF'] = $userLogsWeekDataF;
     $block->setSetting('logsPerDay', json_encode($userLogsWeek));
     $block->setSetting('logsPerDayTotal', $userLogsWeekDataTotal);
 }
开发者ID:bruery,项目名称:platform,代码行数:65,代码来源:UserAuthenticationLogsBlockService.php

示例8: load

 /**
  * {@inheritdoc}
  */
 public function load(BlockInterface $block)
 {
     $currentLoggedUser = $this->manager->fetchCurrentLoggedUser('login');
     $block->setSetting('currentLoggedUser', $currentLoggedUser);
 }
开发者ID:bruery,项目名称:platform,代码行数:8,代码来源:UserAuthenticationLogsStatsBlockService.php

示例9: load

 /**
  * {@inheritdoc}
  */
 public function load(BlockInterface $block)
 {
     $ageBrackets = $this->collectionManager->findByContext($this->context);
     $ageBracket = $this->manager->fetchAgeBracketCount();
     $dataAgeBracketList = [];
     $dataAgeBracketChart = [];
     $dataAgeBracketBar = [];
     //PieChart Data & List Data
     foreach ($ageBrackets as $idx => $bracket) {
         $dataAgeBracketChart[$bracket->getName()] = array(0);
         $dataAgeBracketList[$idx] = ['age' => $bracket->getName(), 'total' => 0];
         foreach ($ageBracket as $age) {
             if ($bracket->getName() == $age['name']) {
                 $dataAgeBracketChart[$bracket->getName()] = array($age['ageBracketCount']);
                 $dataAgeBracketList[$idx] = ['age' => $bracket->getName(), 'total' => $age['ageBracketCount']];
             }
         }
     }
     $ageByGender = $this->manager->fetchAgeBracketCountByGender();
     //LineGraph Data
     $ageX = [];
     $ageU = [];
     $ageF = [];
     $ageM = [];
     foreach ($ageBrackets as $idx => $bracket) {
         $ageX[$idx] = $bracket->getName();
         $ageU[$idx] = "0";
         $ageM[$idx] = "0";
         $ageF[$idx] = "0";
         foreach ($ageByGender as $age) {
             if ($bracket->getName() == $age['name']) {
                 switch ($age['gender']) {
                     case 'u':
                         $ageU[$idx] = $age['ageBracketCount'];
                         break;
                     case 'm':
                         $ageM[$idx] = $age['ageBracketCount'];
                         break;
                     case 'f':
                         $ageF[$idx] = $age['ageBracketCount'];
                         break;
                 }
             }
         }
     }
     $dataAgeBracketBar['x'] = $ageX;
     $dataAgeBracketBar['dataU'] = $ageU;
     $dataAgeBracketBar['dataM'] = $ageM;
     $dataAgeBracketBar['dataF'] = $ageF;
     $ageBracketTotal = $this->manager->fetchAgeBracketCountTotal();
     $block->setSetting('ageBracketList', $dataAgeBracketList);
     $block->setSetting('ageBracketBar', json_encode($dataAgeBracketBar));
     $block->setSetting('ageBracketChart', json_encode($dataAgeBracketChart));
     $block->setSetting('ageBracketTotal', $ageBracketTotal);
 }
开发者ID:bruery,项目名称:platform,代码行数:58,代码来源:ProfileAgeDemogrphicsBlockService.php


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