Exemple #1
0
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new Sforce();
     }
     return self::$instance;
 }
Exemple #2
0
 public function save()
 {
     $sforce = Sforce::getInstance();
     if ($this->id == null) {
         $result = $sforce->saveEntry($this);
     } else {
         $result = $sforce->updateEntry($this);
     }
     return $result;
 }
Exemple #3
0
 public static function login($userid, $password)
 {
     $uid = htmlspecialchars($userid, ENT_COMPAT, 'ISO-8859-1');
     $pwd = htmlspecialchars($password, ENT_COMPAT, 'ISO-8859-1');
     $sforce = Sforce::getInstance();
     $c = $sforce->selfServiceLogin($uid, $pwd);
     if (is_null($c)) {
         return null;
     }
     $cont = new User($sforce);
     $cont->accountId = $c->AccountId;
     $cont->company = $c->Account->fields->Name;
     $cont->contactId = $c->Id;
     $cont->first_name = $c->FirstName;
     $cont->last_name = $c->LastName;
     $cont->phone = $c->Phone;
     $cont->email = $c->Email;
     $cont->title = $c->Title;
     $cont->dept = $c->Department;
     $sforce->loadEntries($cont);
     return $cont;
 }
Exemple #4
0
<?php

require_once 'base.php';
unset($_SESSION['Account']);
$cyear = intval(date('Y')) - 1;
$sforce = Sforce::getInstance();
$current_program = $sforce->getProgram($cyear);
$_SESSION['Current_Program'] = $current_program;
fb($cyear . ' program is ' . $current_program->id);
$prior_program = $sforce->getProgram($cyear - 1);
$_SESSION['Prior_Program'] = $prior_program;
fb('Prior program is ' . $prior_program->id);
$smarty->assign('program', $current_program);
$smarty->assign('nextyear', $cyear + 2);
//next year
$smarty->assign('thisyear', $cyear + 1);
$smarty->assign('programyear', $cyear);
// last year
$smarty->assign('prioryear', $cyear - 1);
//year  before last
$smarty->display('index.tpl');
Exemple #5
0
}
// don't have and decline to answer
$test = array('execic' => 'a0HV0000002aEse', 'senioric' => 'a0HV0000002aEsg', 'promorate' => 'a0HV0000002aEss');
// check to see if they have changed between entries
$testFlag = false;
foreach ($test as $key => $val) {
    $f1 = $entry->getResponseByQuestion($val);
    $f2 = $prior->getResponseByQuestion($val);
    if ($f1 != $f2) {
        writeLog("{$key} status has changed");
        $testFlag = true;
    }
}
// if so, send a notification
if ($testFlag) {
    $url = Sforce::getInstance()->serverURL . $entry->Account__c;
    $subject = 'Top Company Promotion Rate and/or Position Verification';
    $msg = "The Top Company application for {$user->company} has inconsistent position information and should be reviewed. ";
    $msg .= "You may access the entry at {$url}.";
    sendNotification($msg, $subject);
}
try {
    $result = $entry->save();
} catch (Exception $e) {
    $message = "Please type your comment directly or copy and paste only plain text into the comment box.";
}
if ($result != "Saved") {
    echo "Please type your comment directly or copy and paste only plain text into the comment box.";
} else {
    echo "Saved";
}