/** * (non-PHPdoc) * * @see \Contentinum\Service\WebsiteServiceFactory::queryDbCacheResult() */ protected function queryDbCacheResult($config, $sl) { $result = array(); $cache = $sl->get(static::CONTENTINUM_CACHE); $key = $config['cache']; if (!($result = $cache->getItem($key))) { $worker = new Worker($sl->get($config['entitymanager'])); $entries = $worker->fetchAll("SELECT users_id, acl_group_id FROM user_acl_index ORDER BY acl_group_id ASC;"); $ident = false; $rows = array(); $tmp = array(); foreach ($entries as $entry) { if ($ident != $entry['acl_group_id']) { if (false !== $ident) { $rows[$ident] = $tmp; $tmp = array(); } $ident = $entry['acl_group_id']; } $tmp[] = $entry['users_id']; } $rows[$ident] = $tmp; $result = new Config($rows); if (isset($config['savecache']) && true === $config['savecache']) { $cache->setItem($key, $result); } } return $result; }
/** * (non-PHPdoc) * @see \Zend\ServiceManager\FactoryInterface::createService() */ public function createService(ServiceLocatorInterface $serviceLocator) { $worker = new Worker($serviceLocator->get('doctrine.entitymanager.orm_default')); $sql = "SELECT id, name "; $sql .= "FROM user_acl_groups "; $sql .= "WHERE params = 'members' "; $sql .= "ORDER BY name ASC;"; $result = $worker->fetchAll($sql); $options = array(); foreach ($result as $row) { $options[$row['id']] = $row['name']; } return $options; }
/** * (non-PHPdoc) * @see \Zend\ServiceManager\FactoryInterface::createService() */ public function createService(ServiceLocatorInterface $serviceLocator) { $worker = new Worker($serviceLocator->get('doctrine.entitymanager.orm_default')); $sql = "SELECT id, name "; $sql .= "FROM mcevent_dates_config "; $sql .= "ORDER BY name ASC;"; $result = $worker->fetchAll($sql); $options = array(); $options[0] = 'Keine Auswahl'; foreach ($result as $row) { $options[$row['id']] = $row['name']; } return $options; }
/** * (non-PHPdoc) * * @see \Contentinum\Service\WebsiteServiceFactory::queryDbCacheResult() */ protected function queryDbCacheResult($config, $sl) { $result = array(); $cache = $sl->get(static::CONTENTINUM_CACHE); $key = $config['cache']; if (!($result = $cache->getItem($key))) { $worker = new Worker($sl->get($config['entitymanager'])); $datas = $worker->fetchAll('SELECT * FROM mediainuse'); $result = array(); foreach ($datas as $row) { $result[$row['mediasid']][] = array($row['inuseid'], $row['groupname']); } $this->saveCacheItems($key, $result, $cache, $config); } return $result; }
/** * (non-PHPdoc) * @see \Zend\ServiceManager\FactoryInterface::createService() */ public function createService(ServiceLocatorInterface $serviceLocator) { $worker = new Worker($serviceLocator->get('doctrine.entitymanager.orm_default')); $current = date('Y-m-d') . ' 00:00:00'; $selectdate = date('Y'); $sql = "SELECT mtc.id, mtc.date_start, mtc.applicant_int, mtc.applicant_ext, mtc.summary "; $sql .= "FROM mcevent_dates AS mtc "; $sql .= "WHERE mtc.publish = 'yes' "; $sql .= "AND mtc.date_start >= '" . $selectdate . "%' "; $sql .= "AND mtc.configure_id > 0 "; $sql .= "ORDER BY mtc.date_start ASC;"; $trashdates = $worker->fetchAll($sql); $options = array(); $convert = new \ContentinumComponents\Tools\ConvertMonthDayNames(); foreach ($trashdates as $row) { if ($row['date_start'] >= $current) { $datetime = new \DateTime($row['date_start']); $trashDate = $convert->get($datetime->format('N'), 'dayname') . ', ' . $datetime->format('d') . '. ' . $convert->get($datetime->format('m')) . ' ' . $datetime->format('Y'); $options[$row['id']] = $row['summary'] . ' ' . $trashDate; } } return $options; }