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


PHP sfProjectConfiguration类代码示例

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


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

示例1: loadTasks

 /**
  * Loads all available tasks.
  *
  * Looks for tasks in the symfony core, the current project and all project plugins.
  *
  * @param sfProjectConfiguration $configuration The project configuration
  */
 protected function loadTasks(sfProjectConfiguration $configuration)
 {
     // Symfony core tasks
     $dirs = array(sfConfig::get('sf_symfony_lib_dir') . '/task');
     // Plugin tasks
     foreach ($configuration->getPluginPaths() as $path) {
         if (is_dir($taskPath = $path . '/lib/task')) {
             $dirs[] = $taskPath;
         }
     }
     // project tasks
     $dirs[] = sfConfig::get('sf_lib_dir') . '/task';
     $finder = sfFinder::type('file')->name('*Task.class.php');
     foreach ($finder->in($dirs) as $file) {
         $this->taskFiles[basename($file, '.class.php')] = $file;
     }
     // register local autoloader for tasks
     spl_autoload_register(array($this, 'autoloadTask'));
     // require tasks
     foreach ($this->taskFiles as $task => $file) {
         // forces autoloading of each task class
         class_exists($task, true);
     }
     // unregister local autoloader
     spl_autoload_unregister(array($this, 'autoloadTask'));
 }
开发者ID:yasirgit,项目名称:afids,代码行数:33,代码来源:sfSymfonyCommandApplication.class.php

示例2: initialize

 /**
  * @param sfProjectConfiguration $configuration
  * 
  * @return fpErrorNotifier
  */
 public static function initialize(sfProjectConfiguration $configuration)
 {
     if (empty(self::$instance)) {
         $configFiles = $configuration->getConfigPaths('config/notify.yml');
         $config = sfDefineEnvironmentConfigHandler::getConfiguration($configFiles);
         foreach ($config as $name => $value) {
             sfConfig::set("sf_notify_{$name}", $value);
         }
         self::$instance = new self($configuration->getEventDispatcher());
         self::getInstance()->handler()->initialize();
     }
     return self::$instance;
 }
开发者ID:66Ton99,项目名称:fpErrorNotifierPlugin,代码行数:18,代码来源:fpErrorNotifier.php

示例3: __construct

 /**
  * Constructor.
  * 
  * @param sfProjectConfiguration $configuration The project configuration
  * @param string                 $rootDir       The plugin root directory
  * @param string                 $name          The plugin name
  */
 public function __construct(sfProjectConfiguration $configuration, $rootDir = null, $name = null)
 {
     $this->configuration = $configuration;
     $this->dispatcher = $configuration->getEventDispatcher();
     $this->rootDir = null === $rootDir ? $this->guessRootDir() : realpath($rootDir);
     $this->name = null === $name ? $this->guessName() : $name;
     $this->setup();
     $this->configure();
     if (!$this->configuration instanceof sfApplicationConfiguration) {
         $this->initializeAutoload();
         $this->initialize();
     }
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:20,代码来源:sfPluginConfiguration.class.php

示例4: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     $applicationConfig = sfProjectConfiguration::getApplicationConfiguration('frontend', 'prod', true);
     $context = sfContext::createInstance($applicationConfig);
     ProjectConfiguration::registerCron();
     $quiet = (bool) $options['quiet'];
     $passed = array();
     $assigned = array();
     if ($arguments['subreddit'] == '%') {
         if (!$quiet) {
             echo "Advancing EpisodeAssignments for all Subreddits...";
         }
         SubredditTable::getInstance()->advanceEpisodeAssignments();
     } else {
         $subreddit = SubredditTable::getInstance()->findOneByName($arguments['subreddit']);
         if ($subreddit) {
             if (!$quiet) {
                 echo "Advancing EpisodeAssignments for {$subreddit} Subreddit...";
             }
             $subreddit->advanceEpisodeAssignments();
         } else {
             throw new sfException('Cannot find Subreddit: ' . $arguments['subreddit']);
         }
     }
     if (!$quiet) {
         echo "\n";
     }
 }
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:31,代码来源:herdditAdvanceepisodesTask.class.php

示例5: execute

 public function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager(sfProjectConfiguration::getApplicationConfiguration('frontend', $options['env'], true));
     $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', $options['env'], true);
     sfContext::createInstance($configuration);
     $conn = Doctrine_Manager::connection();
     // Récupération de toutes les notices.
     $noeuds = $conn->execute("SELECT id, name FROM ei_data_set_structure;");
     $this->log('Récupération des noeuds...OK');
     // Création de la requête permettant
     $this->log('Création de la requête de mise à jour...');
     $requeteToUpdate = "UPDATE ei_data_set_structure SET slug = #{NEW_SLUG} WHERE id = #{NODE_ID};";
     $requeteGlobale = array();
     foreach ($noeuds->fetchAll() as $noeud) {
         // Remplacement SLUG.
         $tmpRequete = str_replace("#{NEW_SLUG}", $conn->quote(MyFunction::sluggifyForXML($noeud["name"])), $requeteToUpdate);
         // Remplacement ID.
         $tmpRequete = str_replace("#{NODE_ID}", $noeud["id"], $tmpRequete);
         // Ajout dans la requête globale.
         $requeteGlobale[] = $tmpRequete;
     }
     // Préparation de la requête.
     $this->log("Préparation de la requête...");
     $requete = implode(" ", $requeteGlobale);
     try {
         // Exécution de la requête.
         $this->log("Exécution de la requête...");
         $conn->execute($requete);
         // Fin.
         $this->log("Processus terminé avec succès.");
     } catch (Exception $exc) {
         $this->log($exc->getMessage());
     }
 }
开发者ID:lendji4000,项目名称:compose,代码行数:34,代码来源:SluggifyDataSetStructureNamesTask.class.php

示例6: configure

 public function configure()
 {
     sfProjectConfiguration::getActive()->loadHelpers(array('Asset', 'Thumb'));
     $this->widgetSchema['asso_id'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['start_date'] = new sfWidgetDatePicker();
     $this->validatorSchema['start_date'] = new sfValidatorDatePicker(array());
     $this->widgetSchema['end_date'] = new sfWidgetDatePicker();
     $this->validatorSchema['end_date'] = new sfValidatorDatePicker(array());
     $this->widgetSchema['affiche'] = new sfWidgetFormInputFileEditable(array('file_src' => doThumb($this->getObject()->getAffiche(), 'events', array('width' => 150, 'height' => 150), 'scale'), 'is_image' => true, 'edit_mode' => !$this->isNew() && $this->getObject()->getAffiche(), 'with_delete' => true, 'delete_label' => "Supprimer cette illustration"));
     $this->validatorSchema['affiche'] = new sfValidatorFileImage(array('required' => false, 'path' => sfConfig::get('sf_upload_dir') . '/events/source', 'mime_types' => 'web_images', 'max_width' => 1000, 'max_height' => 1000));
     $this->widgetSchema['guest_asso_list']->setOption('method', 'getName');
     $this->widgetSchema->setLabel('guest_asso_list', 'Associations Partenaires');
     $this->widgetSchema['guest_asso_list']->setAttributes(array('style' => 'width:100%;', 'class' => 'select2'));
     $this->validatorSchema['affiche_delete'] = new sfValidatorBoolean();
     $this->widgetSchema->setLabel('name', 'Nom');
     $this->widgetSchema->setLabel('type_id', 'Type');
     $this->widgetSchema->setLabel('start_date', 'Début');
     $this->widgetSchema->setLabel('end_date', 'Fin');
     $this->widgetSchema->setLabel('summary', 'Résumé en une ligne');
     $this->widgetSchema->setLabel('description', 'Description');
     $this->widgetSchema->setLabel('place', 'Lieu');
     $this->widgetSchema->setLabel('is_public', 'Ouvert au public ?');
     $this->widgetSchema->setLabel('affiche', 'Illustration');
     $this->widgetSchema->setLabel('is_weekmail', 'Paraître dans le Weekmail ?');
     $this->widgetSchema['is_weekmail']->setAttribute('style', 'width: 15px;');
     $this->useFields(array('asso_id', 'name', 'type_id', 'start_date', 'end_date', 'summary', 'description', 'place', 'is_public', 'affiche', 'is_weekmail', 'guest_asso_list'));
 }
开发者ID:TheoJD,项目名称:portail,代码行数:27,代码来源:EventForm.class.php

示例7: get

 public static function get()
 {
     sfProjectConfiguration::getActive()->loadHelpers(array("Url"));
     sfProjectConfiguration::getActive()->loadHelpers(array("Tag"));
     //TODO: fix this
     return "<div id='skulebar'>\n\t\t<a id='skule' href='/'>Skule Courses</a>\n\t\t<form method='get' action='" . url_for("search/fuzzySearch") . "' name='frmSearchBar'>\n\t\t<div style='margin: 0pt; padding: 0pt; display: inline;'>\n\t\t</div>\n\t\t<input type='text' title='Quick search in Skule Courses' size='30' name='query' id='search_search' autocomplete='off'/>\n\t\t</form>\n\t\t<div id='user'>\n\t\t<a href='/login'>Login</a>\n\t\t</div>\n\t\t</div>";
 }
开发者ID:jasonkouoft,项目名称:SkuleCourses,代码行数:7,代码来源:SearchBar.class.php

示例8: execute

 protected function execute($arguments = array(), $options = array())
 {
     $context = sfContext::createInstance(sfProjectConfiguration::getApplicationConfiguration('app', $options['env'], true));
     parent::execute($arguments, $options);
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     // add your code here
     $options_task_server_backup = array('location' => $arguments['location'], 'filepath' => $arguments['filepath']);
     if ($arguments['snapshot']) {
         $options_task_server_backup['snapshot'] = $arguments['snapshot'];
     }
     if ($arguments['newsnapshot']) {
         $options_task_server_backup['newsnapshot'] = $arguments['newsnapshot'];
     }
     if ($arguments['delete']) {
         $options_task_server_backup['deletesnapshot'] = $arguments['delete'];
     }
     if ($arguments['location']) {
         if ($arguments['do_not_generate_tar'] && $arguments['do_not_generate_tar'] != 'false') {
             $options_task_server_backup['do_not_generate_tar'] = true;
         }
     }
     $task_server_backup = new serverBackupTask($this->dispatcher, new sfFormatter());
     return $task_server_backup->run(array('serverid' => $arguments['serverid']), $options_task_server_backup);
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:26,代码来源:serverDownloadbackupsnapshotTask.class.php

示例9: execute

    protected function execute($arguments = array(), $options = array()) {
        $databaseManager = new sfDatabaseManager($this->configuration);
        $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
        $context = sfContext::createInstance($this->configuration);
        sfProjectConfiguration::getActive()->loadHelpers('Partial', 'I18N', 'Url');
        $serverUrl = $options['setenvironment'] == '' ? $serverUrl = $options['host'] : $serverUrl = $options['host'] . '/' . $options['setenvironment'];
        $workflows = WorkflowVersionTable::instance()->getWorkflowsToStart(time())->toArray();
        foreach($workflows as $workflow) {
            $sender = WorkflowTemplateTable::instance()->getWorkflowTemplateById($workflow['workflowtemplate_id'])->toArray();
            $userSettings = new UserMailSettings($sender[0]['sender_id']);
            $sendMail = new SendStartWorkflowEmail($userSettings, $context, $workflow, $sender, $serverUrl);
            $workflowTemplate = WorkflowTemplateTable::instance()->getWorkflowTemplateByVersionId($workflow['id']);
            WorkflowVersionTable::instance()->startWorkflowInFuture($workflow['id']);
            $sendToAllSlotsAtOnce = $workflowTemplate[0]->getMailinglistVersion()->toArray();
            if($sendToAllSlotsAtOnce[0]['sendtoallslotsatonce'] == 1) {
                $calc = new CreateWorkflow($workflow['id']);
                $calc->setServerUrl($serverUrl);
                $calc->setContext($context);
                $calc->addAllSlots();
            }
            else {
                $calc = new CreateWorkflow($workflow['id']);
                $calc->setServerUrl($serverUrl);
                $calc->setContext($context);
                $calc->addSingleSlot();
            }

        }
  }
开发者ID:rlauenroth,项目名称:cuteflow_v3,代码行数:29,代码来源:startWorkflowTask.class.php

示例10: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     $applicationConfig = sfProjectConfiguration::getApplicationConfiguration('frontend', 'prod', true);
     $context = sfContext::createInstance($applicationConfig);
     // Go to the Subreddit and obtain the past few keys.
     $reddit_location = $options['subreddit'];
     $reddit = new RedditObject($reddit_location);
     $quiet = (bool) $options['quiet'];
     if (!$quiet) {
         echo "Obtaining the most recent comments from {$reddit_location}...";
     }
     $reddit->appendData();
     $found_keys = count($reddit->getComments());
     if (!$quiet) {
         echo "\nFound {$found_keys} keys.  Updating keys in the database...";
     }
     ValidationTable::getInstance()->storeNewKeys($reddit->getComments());
     // Now that new keys are stored in the database we need to update all applicable users
     $users = sfGuardUserTable::getInstance()->getUsersToBeValidated();
     $updated = sfGuardUserTable::getInstance()->validateUsers($users);
     if (!$quiet) {
         echo "\nSending emails...";
     }
     foreach ($users as $user_id) {
         $sf_user = $context->getUser();
         $sf_user->setApiUserId($user_id);
         $sf_user->sendMail('RedditValidationSucceeded');
     }
     if (!$quiet) {
         echo "\n{$updated} users validated and email sent.\n";
     }
 }
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:35,代码来源:herdditValidateusersTask.class.php

示例11: initialize

 /**
  * Initializes the current sfGenerator instance.
  *
  * @param sfGeneratorManager $generatorManager A sfGeneratorManager instance
  */
 public function initialize(sfGeneratorManager $generatorManager)
 {
     parent::initialize($generatorManager);
     $configuration = sfProjectConfiguration::getActive();
     $this->databaseManager = new sfDatabaseManager($configuration);
     $this->setGeneratorClass('sfDoctrineModule');
 }
开发者ID:blt04,项目名称:sfDoctrine2Plugin,代码行数:12,代码来源:sfDoctrineGenerator.class.php

示例12: executeIndex

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->user = $this->getUser();
     //$user_id = $_SESSION['symfony/user/sfUser/attributes']['symfony/user/sfUser/attributes']['user_id'];
     $user = $this->getUser()->getRaykuUser();
     if ($user) {
         $user_id = $user->getId();
     }
     if (!$user_id) {
         $this->forward('/dashboard');
     }
     $this->setVar('user_id', $user_id);
     //Form submitted
     if (sfWebRequest::POST == $this->getRequest()->getMethod()) {
         $emails = $this->getRequestParameter('emails');
         $ref = $this->getRequestParameter('ref');
         if (!$emails) {
             echo "Invalid emails";
             return false;
         }
         $mail = Mailman::createMailer();
         $mail->setContentType('text/html');
         $mail->addAddress($emails);
         $mail->setSubject('Invitation');
         sfProjectConfiguration::getActive()->loadHelpers(array('Asset', 'Url', 'Partial'));
         $mail->setBody(get_partial('invitationEmailHtml', array('ref' => $ref, 'user' => $user)));
         $mail->send();
         //$this->forward('referrals', 'invitesSent');
     }
 }
开发者ID:rayku,项目名称:rayku,代码行数:35,代码来源:actions.class.php

示例13: executeNovaPagina

 public function executeNovaPagina(sfWebRequest $request)
 {
     if ($request->isXmlHttpRequest() || true) {
         //apenas por ajax
         sfConfig::set('sf_web_debug', false);
         sfProjectConfiguration::getActive()->loadHelpers(array('I18N', 'Date'));
         $cmspage = new Cmspage();
         $content = new Content();
         $content->setId(null);
         $cmspage->setContent($content);
         $cmspage->setId(null);
         $cmsGroupcontent = $this->getUser()->getAttribute('contentGroup');
         $this->forward404Unless($cmsGroupcontent);
         $cmspage->setCmsgroupcontent($cmsGroupcontent);
         $this->formContent = new PageContentForm($cmspage);
         if ($request->isMethod('post')) {
             //return $this->renderPartial('cms/debug',array('values'=>$request->getParameter('pagina')));
             $this->formContent->bind($request->getParameter('pagina'));
             if ($this->formContent->isValid()) {
                 $this->logMessage('O formContent foi válido. cms/actions: ' . __FILE__ . __LINE__);
                 try {
                     $this->formContent->save();
                     return $this->renderPartial("cms/viewPage", array('page' => $this->formContent->getCmspageobj(), 'isNew' => true, 'values' => $this->formContent->getValues()));
                 } catch (Exception $e) {
                     //TODO: We should to handle the error and render it.
                     throw $e;
                 }
                 //return $this->renderPartial("cms/viewPage",array('page'));
             }
         }
         //parent::executeNew($request);
         return $this->renderPartial('cms/content_form', array('formContent' => $this->formContent));
     }
 }
开发者ID:rafaelccomp,项目名称:compsite,代码行数:34,代码来源:actions.class.php

示例14: customize

 public function customize($params)
 {
     $params['moduleName'] = 'search';
     sfToolkit::clearDirectory(sfConfig::get('sf_app_cache_dir'));
     $generatorManager = new sfGeneratorManager(sfProjectConfiguration::getActive());
     sfGeneratorConfigHandler::getContent($generatorManager, 'xfGeneratorInterface', $params);
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:7,代码来源:xfGeneratorInterfaceTest.php

示例15: execute

 protected function execute($arguments = array(), $options = array())
 {
     $context = sfContext::createInstance(sfProjectConfiguration::getApplicationConfiguration('app', 'dev', true));
     parent::execute($arguments, $options);
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $con = $databaseManager->getDatabase($options['connection'])->getConnection();
     // add your code here
     $this->log('[INFO] Flushing old data...' . "\n");
     $eventlog_flush = EtvaSettingPeer::retrieveByPK('eventlog_flush');
     $flush_range = $eventlog_flush->getValue();
     $con->beginTransaction();
     $affected = 0;
     try {
         $offset_date = date("c", time() - $flush_range * 24 * 60 * 60);
         /*
          * get event records that have creation date outdated
          */
         $c = new Criteria();
         $c->add(EtvaEventPeer::CREATED_AT, $offset_date, Criteria::LESS_THAN);
         $affected = EtvaEventPeer::doDelete($c, $con);
         $con->commit();
         $message = sprintf('Events Log - %d Record(s) deleted after %d day offset', $affected, $flush_range);
         $context->getEventDispatcher()->notify(new sfEvent(sfConfig::get('config_acronym'), 'event.log', array('message' => $message)));
         $this->log('[INFO] ' . $message);
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     $logger = new sfFileLogger($context->getEventDispatcher(), array('file' => sfConfig::get("sf_log_dir") . '/cron_status.log'));
     // log the message!
     $logger->log("[INFO] The events flush task ran!", 6);
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:33,代码来源:eventFlushlogTask.class.php


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