public function __construct($form, $user)
 {
     $this->pay_key = false;
     $this->setMyPurchase($form, $user);
     $this->setAmount();
     $this->setGCFee();
     $this->setOwnerFee();
     $this->setCommissionFee();
     $this->testing = gcr::paypalSandbox;
     $app = $this->my_purchase->getPurchaseTypeApp();
     if ($this->testing) {
         $this->ipn_url = 'https://' . $app->getshortName() . '.globalcampus.us/purchase/ipn';
     } else {
         $this->ipn_url = $app->getUrl() . '/purchase/ipn';
     }
     $this->my_purchase->setAmount($this->amount);
     $this->my_purchase->setGcFee($this->gc_fee);
     $this->my_purchase->setOwnerFee($this->owner_fee);
     $this->my_purchase->setCommissionFee($this->commission_fee);
     $this->my_purchase->setPurchaseTypeDescription($this->my_purchase->getPurchaseDescription());
     $this->my_purchase->save();
     $this->my_purchase->assignSeller();
     $this->receivers = self::getReceivers($this->my_purchase);
     if (count($this->receivers) < 2) {
         global $CFG;
         $CFG->current_app->gcError('No receivers found for Paypal chained payment, purchase ID: ' . $this->my_purchase->getId(), 'gcdatabaseerror');
     }
     gcr::loadSdk('paypal_adaptive_payments');
 }
 public static function deleteBucket($app)
 {
     $user_storage_s3 = Doctrine::getTable('GcrUserStorageS3')->findOneByAppId($app->getShortName());
     if ($user_storage_s3) {
         $account = GcrUserStorageS3Table::getAccount($app);
         define('AWS_KEY', $account->getAccessKeyId());
         define('AWS_SECRET_KEY', $account->getSecretAccessKey());
         gcr::loadSdk('aws');
         $api = new AmazonS3();
         $api->delete_bucket($user_storage_s3->getBucketName(), true);
         $user_storage_s3->delete();
     }
 }
 public function __construct($app = false)
 {
     $this->app = $app;
     if (!$app) {
         global $CFG;
         $this->app = $CFG->current_app;
     }
     $account = GcrUserStorageS3Table::getAccount($this->app);
     define('AWS_KEY', $account->getAccessKeyId());
     define('AWS_SECRET_KEY', $account->getSecretAccessKey());
     gcr::loadSdk('aws');
     $this->api = new AmazonS3();
     if (!($user_storage_s3 = Doctrine::getTable('GcrUserStorageS3')->findOneByAppId($this->app->getInstitution()->getShortName()))) {
         $user_storage_s3 = $this->createBucket($account);
     } else {
         $this->bucket = $user_storage_s3->getBucketName();
     }
 }
 public function printFooter()
 {
     $institution = $this->institution;
     $content = '<div id="footer-wrap">';
     $footer_links = $institution->selectFromMhrTable('config', 'field', 'footerlinks', true);
     $content .= '<div id="footernavleft"><a href="' . $institution->getSupportUrl() . '" target="_blank">Technical Support</a></div>';
     $content .= '<div id="footernav">';
     if ($pos = strpos($footer_links->value, 'termsandconditions')) {
         $content .= '<a href="' . $institution->getAppUrl() . 'terms.php">Terms and Conditions</a>';
         $content .= '|';
     }
     if ($pos = strpos($footer_links->value, 'privacystatement')) {
         $content .= '<a href="' . $institution->getAppUrl() . 'privacy.php">Privacy Statement</a>';
         $content .= '|';
     }
     if ($pos = strpos($footer_links->value, 'about')) {
         $content .= '<a href="' . $institution->getAppUrl() . 'about.php">About</a>';
         $content .= '|';
     }
     if ($pos = strpos($footer_links->value, 'contactus')) {
         $content .= '<a href="http://' . gcr::domainName . '/info/contact">Contact Us</a>';
     }
     $content .= '</div>';
     $content .= '<div id="poweredby">';
     $content .= '<a href="http://globalclassroom.us">';
     $content .= '<img src="https://s3.amazonaws.com/static.globalclassroom.us/marketing/Stratus/poweredby_blk-trans.png" alt="powered by globalclassroom" />';
     $content .= '</a></div>';
     $content .= '</div>';
     // turn background black if site admin
     $app = gcr::getApp();
     $current_user = $app->getCurrentUser();
     if ($current_user) {
         $role_manager = $current_user->getRoleManager();
         if ($role_manager->hasPrivilege('GCAdmin')) {
             $content .= '<script type="text/javascript">';
             $content .= 'jQuery("body").css("background", "#000")';
             $content .= '</script>';
         }
     }
     print $content;
 }
 public function executeView($request)
 {
     $this->authorizeRequest($request);
     $this->gc_chat_session_id = 0;
     $chat_session = false;
     $user_id = $request->getParameter('user_id');
     if ($user_id) {
         if ($this->mhr_user = $this->user->getApp()->getUserById($user_id)) {
             if ($invites = $this->user->getPendingChatInvites($this->mhr_user)) {
                 $invites[0]->createUserSession();
                 $this->gc_chat_session_id = $invites[0]->getSessionId();
             } else {
                 if ($chats = $this->user->getChatSessionsWithUser($this->mhr_user)) {
                     $this->gc_chat_session_id = $chats[0]->getId();
                 } else {
                     if ($this->mhr_user->getAvailabilityStatus()->showChat()) {
                         if ($chat_session = $this->user->inviteUserToChat($this->mhr_user)) {
                             $this->gc_chat_session_id = $chat_session->getId();
                         }
                     }
                 }
             }
         }
     }
     if (!$chat_session) {
         $chat_session = Doctrine::getTable('GcrChatSession')->find($this->gc_chat_session_id);
         if (!$chat_session) {
             global $CFG;
             $CFG->current_app->gcError('Chat session not found', 'gcdatabaseerror');
         }
     }
     gcr::loadSdk('opentok');
     $this->api = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET);
     $this->session_id = $chat_session->getRoomId();
     $metadata = '{"username": "******"}';
     $this->token = $this->api->generate_token($this->session_id, RoleConstants::PUBLISHER, null, $metadata);
     $this->getResponse()->setTitle($this->mhr_user->getFullnameString() . ' - Video Conference');
     sfConfig::set('sf_escaping_strategy', false);
 }
<?php

$app = gcr::getApp();
if ($app->isMoodle()) {
    $app = $app->getInstitution();
}
?>
<div id="sb-configuresite" class="sideblock sideblock-1">
    <h3>Configure Site</h3>
        <div class="sideblock-content">
            <ul>
                <li id="sb-siteoptions">
                    <a href="<?php 
echo $app->getAppUrl();
?>
artefact/eschooladmin/settings.php">
                        <img src="/images/icons/siteoptions.png" alt="Site Options"/>&nbsp;Site options
                    </a>
                </li>
                <li id="sb-accounting">
                    <a href="<?php 
echo $app->getUrl();
?>
/account/view">
                        <img src="/images/icons/eschool-accounting.png" alt="accounting"/>&nbsp;Accounting
                    </a>
                </li>
                <li id="sb-eclassrooms_management">
                    <a href="<?php 
$app->getUrl();
?>
 public function createChatSession()
 {
     try {
         $this->app->beginTransaction();
         // create chat session record
         $chat_session = new GcrChatSession();
         gcr::loadSdk('opentok');
         $api = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET);
         $session = $api->create_session($_SERVER["REMOTE_ADDR"]);
         $chat_session->setRoomId($session->getSessionId());
         $chat_session->setEschoolId($this->app->getShortName());
         $chat_session->setTimeCreated(time());
         $chat_session->save();
         // create chat session users record
         $chat_session->createUserSession($this);
         $this->app->commitTransaction();
     } catch (Doctrine_Exception $e) {
         $this->app->rollbackTransaction();
         global $CFG;
         $CFG->current_app->gcError($e->getMessage(), 'gcdatabaseerror');
     }
     return $chat_session;
 }
Ejemplo n.º 8
0
        define('GC_SYMFONY_LOADED', true);
    }
    $institution = Doctrine::getTable('GcrInstitution')->findOneByShortName($shortname);
    GcrInstitutionTable::constructCurrentInstitution($institution);
    $cfg->dbtype = 'postgres8';
    $cfg->dbhost = gcr::DBHostName;
    $cfg->dbport = gcr::DBPort;
    $cfg->dbname = gcr::DBName;
    $cfg->dataroot = gcr::moodledataDir . $shortname;
    $cfg->dbuser = '******' . $shortname . 'admin';
    $cfg->dbpass = $CFG->current_app->getAdminPassword();
    $cfg->dbprefix = gcr::maharaPrefix;
    $cfg->wwwroot = $CFG->current_app->getAppUrl();
    define('GC_CRON_RUNNING', true);
} else {
    if (gcr::initialize()) {
        global $CFG;
        if (!$CFG->current_app->isMahara()) {
            // the url is bad because it points to the Mahara folder on a moodle short_name
            header('Location: ' . $CFG->current_app->getInstitution()->getAppUrl());
            die;
        }
        // database connection details
        // valid values for dbtype are 'postgres8' and 'mysql5'
        $cfg->dbtype = 'postgres8';
        $cfg->dbhost = gcr::DBHostName;
        $cfg->dbport = gcr::DBPort;
        $cfg->dbname = gcr::DBName;
        $cfg->dbuser = '******' . $CFG->current_app->getShortName() . 'admin';
        $cfg->dbpass = $CFG->current_app->getAdminPassword();
        // Note: database prefix is NOT required, you don't need to set one except if
Ejemplo n.º 9
0
<?php

require_once dirname(__FILE__) . '/../config/ProjectConfiguration.class.php';
require_once '/var/www/globalclassroom4/lib/model/gcr_model/gcr.class.php';
gcr::initialize();
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false);
sfContext::createInstance($configuration)->dispatch();