Beispiel #1
0
 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']);
     }
 }
Beispiel #4
0
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()) {
        ?>
&nbsp;<?php 
        echo link_to(__('Add schedule to Google Calendar'), '@calendar_api_import');
        ?>
&nbsp;(<?php 
        echo link_to(__('Revoke Google calendar OAuth key'), '@member_config?category=schedule');
        ?>
)
<?php 
    } else {
        ?>
&nbsp;<?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);
 }
Beispiel #6
0
 public function preExecute()
 {
     $this->forward404Unless(opConfig::get('op_calendar_google_data_api_is_active', false));
     $this->opCalendarOAuth = opCalendarOAuth::getInstance();
 }