public static function getInstance() { if (null === self::$instance) { self::$instance = new self(); } return self::$instance; }
public function validateId($validator, $values, $arguments = array()) { if (opCalendarOAuth::getInstance()->isAlreadyUsedCalendarId($this->member)) { throw new sfValidatorError($validator, 'This calendar is used other SNS Member.'); } return $values; }
protected function execute($arguments = array(), $options = array()) { new sfDatabaseManager($this->configuration); if (!opConfig::get('op_calendar_google_data_api_auto_update', false)) { throw new sfException('This task is not allowed. Please allow from "pc_backend.php/opCalendarPlugin" setting.'); } $crons = opCalendarPluginToolkit::getAllGoogleCalendarCronConfig(); if (!count($crons)) { $this->logSection('end', 'No cron data'); return true; } $this->opCalendarOAuth = opCalendarOAuth::getInstance(); $this->logSection('prepared', 'start update'); foreach ($crons as $cron) { $this->updateMemberSchedule($cron, (int) $options['interval']); } }
use_helper('opCalendar'); ?> <div class="dparts monthlyCalendarTable"><div class="parts"> <div class="partsHeading"><h3><?php $is_community ? printf('[%s] ', $community->name) : ''; echo format_number_choice('[0]%ym%|[1]%ym% of %f%', array('%ym%' => op_format_date(mktime(0, 0, 0, $ym['month_disp'], 1, $ym['year_disp']), 'XCalendarMonth'), '%f%' => $member->name), $is_community ? 1 : $isSelf ? 0 : 1); ?> </h3></div> <?php if (!$is_community && $isSelf && opConfig::get('op_calendar_google_data_api_is_active', false)) { ?> <div class="block topBox"> <p class="note_schedule"> <?php if (opCalendarOAuth::getInstance()->authenticate()) { ?> <?php echo link_to(__('Add schedule to Google Calendar'), '@calendar_api_import'); ?> (<?php echo link_to(__('Revoke Google calendar OAuth key'), '@member_config?category=schedule'); ?> ) <?php } else { ?> <?php echo link_to(__('Enable to Google Calendar\'s permission settings'), '@calendar_api'); } ?>
private function isOAuthAuthenticate() { $this->opCalendarOAuth = opCalendarOAuth::getInstance(); return $this->opCalendarOAuth->authenticate($this->member); }
public function preExecute() { $this->forward404Unless(opConfig::get('op_calendar_google_data_api_is_active', false)); $this->opCalendarOAuth = opCalendarOAuth::getInstance(); }