示例#1
0
 function delete($id = FALSE)
 {
     if ($id) {
         $executive = new Executive($id);
         $executive->delete();
         set_notify('success', lang('delete_data_complete'));
     }
     redirect($_SERVER['HTTP_REFERER']);
 }
示例#2
0
function executionAction(&$body)
{
    $classConstruct =& $body->getClassConstruct();
    $methodName = $body->methodName;
    $args = $body->getValue();
    $output = Executive::doMethodCall($body, &$classConstruct, $methodName, $args);
    if ($output !== "__amfphp_error") {
        $body->setResults($output);
    }
}
示例#3
0
文件: Year.php 项目: robinchow/rms
 public function directors()
 {
     $d_id = Executive::where('position', '=', 'Directors')->first()->id;
     $d_joins = DB::table('executive_user')->where('year_id', '=', $this->id)->where('executive_id', '=', $d_id)->where('non_executive', '=', false)->get();
     $directors = array();
     foreach ($d_joins as $d) {
         $directors[] = User::find($d->user_id);
     }
     return $directors;
 }
示例#4
0
function CakeClassLoaderAction(&$amfbody)
{
    if (!$amfbody->noExec) {
        // change to the gateway.php script directory
        // now change to the directory of the classpath.  Possible relative to gateway.php
        $dirname = dirname($amfbody->classPath);
        if (is_dir($dirname)) {
            chdir($dirname);
        } else {
            $ex = new MessageException(E_USER_ERROR, "The classpath folder {" . $amfbody->classPath . "} does not exist. You probably misplaced your service.", __FILE__, __LINE__, "AMFPHP_CLASSPATH_NOT_FOUND");
            MessageException::throwException($amfbody, $ex);
            return false;
        }
        $fileExists = @file_exists(basename($amfbody->classPath));
        // see if the file exists
        if (!$fileExists) {
            $ex = new MessageException(E_USER_ERROR, "The class {" . $amfbody->className . "} could not be found under the class path {" . $amfbody->classPath . "}", __FILE__, __LINE__, "AMFPHP_FILE_NOT_FOUND");
            MessageException::throwException($amfbody, $ex);
            return false;
        }
        $fileIncluded = Executive::includeClass($amfbody, "./" . basename($amfbody->classPath));
        if (!$fileIncluded) {
            $ex = new MessageException(E_USER_ERROR, "The class file {" . $amfbody->className . "} exists but could not be included. The file may have syntax errors, or includes at the top of the file cannot be resolved.", __FILE__, __LINE__, "AMFPHP_FILE_NOT_INCLUDED");
            MessageException::throwException($amfbody, $ex);
            return false;
        }
        if (!class_exists($amfbody->className)) {
            // Just make sure the class name is the same as the file name
            $ex = new MessageException(E_USER_ERROR, "The file {" . $amfbody->className . ".php} exists and was included correctly but a class by that name could not be found in that file. Perhaps the class is misnamed.", __FILE__, __LINE__, "AMFPHP_CLASS_NOT_FOUND");
            MessageException::throwException($amfbody, $ex);
            return false;
        }
        //Let executive handle building the class
        //The executive can handle making exceptions and all that, that's why
        $classConstruct = Executive::buildClass($amfbody, $amfbody->className);
        if ($classConstruct !== '__amfphp_error') {
            $amfbody->setClassConstruct($classConstruct);
            setupCakeController($classConstruct);
        } else {
            return false;
        }
    }
    return true;
}
 /**
  * The main method of the executive class.
  * 
  * @param array $a Arguments to pass to the method
  * @return mixed The results from the method operation
  */
 function doMethodCall(&$bodyObj, &$object, $method, $args)
 {
     try {
         $output = Executive::deferredMethodCall($bodyObj, $object, $method, $args);
     } catch (Exception $fault) {
         if (get_class($fault) == "VerboseException") {
             $ex = new MessageException($fault->code, $fault->getMessage(), $fault->file, $fault->line, 'AMFPHP_RUNTIME_ERROR');
         } else {
             $code = "AMFPHP_RUNTIME_ERROR";
             if ($fault->getCode() != 0) {
                 $code = $fault->getCode();
             }
             $ex = new MessageException(E_USER_ERROR, $fault->getMessage(), $fault->getFile(), $fault->getLine(), $code);
         }
         MessageException::throwException($bodyObj, $ex);
         $output = '__amfphp_error';
     }
     return $output;
 }
示例#6
0
function executionAction(&$body)
{
    $classConstruct = $body->getClassConstruct();
    $methodName = $body->methodName;
    $className = $body->className;
    $xmlrpc_server = xmlrpc_server_create();
    $lambdaFunc = 'return adapterMap(call_user_func_array (array(&$userData[0], $userData[1]), $args));';
    $func = create_function('$a,$args,$userData', $lambdaFunc);
    xmlrpc_server_register_method($xmlrpc_server, $body->packageClassMethodName, $func);
    $request_xml = $body->getValue();
    $args = array($xmlrpc_server, $request_xml, array(&$classConstruct, $methodName));
    $nullObj = NULL;
    $response = Executive::doMethodCall($body, $nullObj, 'xmlrpc_server_call_method', $args);
    //$response = xmlrpc_server_call_method();
    if ($response !== "__amfphp_error") {
        $body->setResults($response);
    } else {
        return false;
    }
}
示例#7
0
        if ($name == "") {
            echo "Name cannot be blank!";
        } else {
            $this->name = $name;
        }
    }
    # Define a getter for the private $name member
    function getName()
    {
        return "My name is " . $this->name . "<br />";
    }
}
#end Employee class
# Define an Executive class that inherits Employee
class Executive extends Employee
{
    # Define a method unique to Employee
    function pillageCompany()
    {
        echo "I'm selling company assets to finance my yacht!";
    }
}
#end Executive class
# Create a new Executive object
$exec = new Executive();
# Call the setName() method, defined in the Employee class
$exec->setName("Richard");
# Call the getName() method
echo $exec->getName();
# Call the pillageCompany() method
$exec->pillageCompany();
示例#8
0
 function exe_more()
 {
     $executives = new Executive();
     lang_filter($executives->where("start_date <= date(sysdate()) and (end_date >= date(sysdate()) or end_date = date('0000-00-00')) and status = 'approve'"));
     $data['executives'] = $executives->order_by('id', 'desc')->get();
     $this->template->build('exe_more', $data);
 }
示例#9
0
/**
 * Class loader action loads the class from which we will get the remote method
 */
function cakeClassLoaderAction(&$amfbody)
{
    if (!$amfbody->noExec) {
        // change to the gateway.php script directory
        // now change to the directory of the classpath.  Possible relative to gateway.php
        $dirname = dirname($amfbody->classPath);
        if (is_dir($dirname)) {
            //chdir($dirname);
        } else {
            $ex = new MessageException(E_USER_ERROR, "The classpath folder {" . $amfbody->classPath . "} does not exist. You probably misplaced your service.", __FILE__, __LINE__, "AMFPHP_CLASSPATH_NOT_FOUND");
            MessageException::throwException($amfbody, $ex);
            return false;
        }
        //$fileExists = @file_exists(basename($amfbody->classPath)); // see if the file exists
        $fileExists = @file_exists($amfbody->classPath);
        // see if the file exists
        if (!$fileExists) {
            $ex = new MessageException(E_USER_ERROR, "The class {" . $amfbody->className . "} could not be found under the class path {" . $amfbody->classPath . "}", __FILE__, __LINE__, "AMFPHP_FILE_NOT_FOUND");
            MessageException::throwException($amfbody, $ex);
            return false;
        }
        global $amfphp;
        $time = microtime_float();
        //$fileIncluded = Executive::includeClass($amfbody, "./" . basename($amfbody->classPath));
        $fileIncluded = Executive::includeClass($amfbody, $amfbody->classPath);
        $amfphp['includeTime'] += microtime_float() - $time;
        if (!$fileIncluded) {
            $ex = new MessageException(E_USER_ERROR, "The class file {" . $amfbody->className . "} exists but could not be included. The file may have syntax errors, or includes at the top of the file cannot be resolved.", __FILE__, __LINE__, "AMFPHP_FILE_NOT_INCLUDED");
            MessageException::throwException($amfbody, $ex);
            return false;
        }
        if (!class_exists($amfbody->className)) {
            // Just make sure the class name is the same as the file name
            $ex = new MessageException(E_USER_ERROR, "The file {" . $amfbody->className . ".php} exists and was included correctly but a class by that name could not be found in that file. Perhaps the class is misnamed.", __FILE__, __LINE__, "AMFPHP_CLASS_NOT_FOUND");
            MessageException::throwException($amfbody, $ex);
            return false;
        }
        //Let executive handle building the class
        //The executive can handle making exceptions and all that, that's why
        $classConstruct = Executive::buildClass($amfbody, $amfbody->className);
        $classConstruct->params['controller'] = Inflector::underscore(str_replace('Controller', '', $amfbody->className));
        $classConstruct->params['action'] = strtolower($amfbody->methodName);
        //We need exception handling when initializing CakePHP controllers,
        // (AmfAuth component, beforeFilters can throw exceptions). This way exceptions
        // are handled correctly, and returned through amf message
        $object = null;
        $init = Executive::doMethodCall($amfbody, $object, 'initCakeController', array($classConstruct));
        if ($init === '__amfphp_error') {
            return false;
        }
        if ($classConstruct !== '__amfphp_error') {
            $amfbody->setClassConstruct($classConstruct);
        } else {
            return false;
        }
    }
    return true;
}
示例#10
0
/**
 * MetaDataAction loads the required info from the methodTable
 */
function securityAction(&$amfbody)
{
    if (!$amfbody->noExec) {
        $classConstruct =& $amfbody->getClassConstruct();
        $methodName = $amfbody->methodName;
        $className = $amfbody->className;
        //Check if method exists
        if (!method_exists($classConstruct, $methodName)) {
            // check to see if the method exists
            $ex = new MessageException(E_USER_ERROR, "The method  {" . $methodName . "} does not exist in class {" . $className . "}.", __FILE__, __LINE__, "AMFPHP_INEXISTANT_METHOD");
            MessageException::throwException($amfbody, $ex);
            return false;
        }
        //Check if method is private (PHP4)
        if (strpos($methodName, '_') === 0) {
            // check to see if the method exists
            $ex = new MessageException(E_USER_ERROR, "The method  {" . $methodName . "} starts with an underscore and is therefore considered private, so it cannot be remotely called.", __FILE__, __LINE__, "AMFPHP_PRIVATE_METHOD");
            MessageException::throwException($amfbody, $ex);
            return false;
        }
        //Check to see if method is private or protected (PHP5)
        if (class_exists('ReflectionMethod')) {
            $method = new ReflectionMethod($className, $methodName);
            if (!$method->isPublic()) {
                $ex = new MessageException(E_USER_ERROR, "The method  {" . $methodName . "} in {" . $className . "} is not public and therefore cannot be called.", __FILE__, __LINE__, "AMFPHP_PRIVATE_METHOD");
                MessageException::throwException($amfbody, $ex);
                return false;
            }
        }
        $classConstruct =& $amfbody->getClassConstruct();
        $methodName = $amfbody->methodName;
        $className = $amfbody->className;
        if (method_exists($classConstruct, "beforeFilter")) {
            //Pass throught the executive
            $allow = Executive::doMethodCall($amfbody, $classConstruct, 'beforeFilter', array($methodName));
            if ($allow === '__amfphp_error' || $allow === false) {
                $ex = new MessageException(E_USER_ERROR, "Method access blocked by beforeFilter in " . $className . " class", __FILE__, __LINE__, "AMFPHP_AUTHENTICATE_ERROR");
                MessageException::throwException($amfbody, $ex);
                return false;
            }
        }
    }
    return true;
}
示例#11
0
 public function __construct()
 {
     parent::__construct();
 }
示例#12
0
 public function get_delete($id)
 {
     $executive = Executive::find($id)->delete();
     return Redirect::to('rms/executives')->with('success', 'Successfully Removed Executive Position');
 }
 /**
  * Handles the ordering of models.
  */
 public function actionOrder()
 {
     if ($this->menu_use[1]) {
         // Handle the POST request data submission
         if (isset($_POST['Order'])) {
             // Since we converted the Javascript array to a string,
             // convert the string back to a PHP array
             $models = explode(',', $_POST['Order']);
             for ($i = 0; $i < sizeof($models); $i++) {
                 if ($model = Executive::model()->findbyPk($models[$i])) {
                     $model->sort_order = $i;
                     $model->save();
                 }
             }
         } else {
             $dataProvider = new CActiveDataProvider('Executive', array('pagination' => false, 'criteria' => array('order' => 'sort_order ASC, exec_id DESC')));
             $this->render('order', array('dataProvider' => $dataProvider));
         }
     } else {
         $this->redirect(array('site/index'));
     }
 }
示例#14
0
/**
 * ExecutionAction executes the required methods
 */
function executionAction(&$amfbody)
{
    $specialHandling = $amfbody->getSpecialHandling();
    if (!$amfbody->isSpecialHandling() || $amfbody->isSpecialHandling(array('describeService', 'pageFetch', 'RemotingMessage'))) {
        $construct =& $amfbody->getClassConstruct();
        $method = $amfbody->methodName;
        $args = $amfbody->getValue();
        if ($specialHandling == 'describeService') {
            include_once AMFPHP_BASE . "util/DescribeService.php";
            $ds = new DescribeService();
            $results = $ds->describe($construct, $amfbody->className);
        } else {
            if ($specialHandling == 'pageFetch') {
                $args[count($args) - 2] = $args[count($args) - 2] - 1;
                $dataset = Executive::doMethodCall($amfbody, $construct, $method, $args);
                $results = array("cursor" => $args[count($args) - 2] + 1, "data" => $dataset);
                $amfbody->setMetadata('type', '__DYNAMIC_PAGE__');
            } else {
                /*
                			if(isset($construct->methodTable[$method]['pagesize']))
                			{
                //Check if counting method was overriden
                if(isset($construct->methodTable[$method]['countMethod']))
                {
                	$counter = $construct->methodTable[$method]['countMethod'];
                }
                else
                {
                	$counter = $method . '_count';
                }
                
                $dataset = Executive::doMethodCall($amfbody, $construct, $method, $args); // do the magic
                $count = Executive::doMethodCall($amfbody, $construct, $counter, $args);
                
                //Include the wrapper
                $results = array('class' => $amfbody->uriClassPath, 
                				 'method' => $amfbody->methodName, 
                				 'count' => $count, 
                				 "args" => $args, 
                				 "data" => $dataset);
                $amfbody->setMetadata('type', '__DYNAMIC_PAGEABLE_RESULTSET__');
                $amfbody->setMetadata('pagesize', $construct->methodTable[$method]['pagesize']);
                */
                //}
                //else
                //{
                //The usual
                $time = microtime_float();
                $results = Executive::doMethodCall($amfbody, $construct, $method, $args);
                // do the magic
                global $amfphp;
                $amfphp['callTime'] += microtime_float() - $time;
                //}
            }
        }
        if ($results !== '__amfphp_error') {
            if ($specialHandling == 'RemotingMessage') {
                $wrapper = new AcknowledgeMessage($amfbody->getMetadata("messageId"), $amfbody->getMetadata("clientId"));
                $wrapper->body = $results;
                $amfbody->setResults($wrapper);
            } else {
                $amfbody->setResults($results);
            }
            $amfbody->responseURI = $amfbody->responseIndex . "/onResult";
        }
        return false;
    } elseif ($specialHandling == 'Ping') {
        $wrapper = new AcknowledgeMessage($amfbody->getMetadata("messageId"), $amfbody->getMetadata("clientId"));
        $amfbody->setResults($wrapper);
        $amfbody->responseURI = $amfbody->responseIndex . "/onResult";
    } else {
        if ($specialHandling == 'pageRelease') {
            //Ignore PageAbleResult.release
            $amfbody->setResults(true);
            $amfbody->setMetaData('type', 'boolean');
            $amfbody->responseURI = $amfbody->responseIndex . "/onResult";
            return false;
        }
    }
    return true;
}
示例#15
0
 public function loadExecutiveModel($id)
 {
     $model = Executive::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
示例#16
0
 public function postExecutive()
 {
     $exe = new Executive();
     $exe->ex_name = Input::get('ex_name');
     $exe->location = Input::get('location');
     $exe->save();
     return Response::json($exe);
 }
示例#17
0
 <?php 
class Employee
{
    public static $favSport = "Football";
    public static function watchTV()
    {
        echo "Watching " . self::$favSport;
    }
}
class Executive extends Employee
{
    public static $favSport = "Polo";
}
echo Executive::watchTV();
?>

示例#18
0
/**
 * ExecutionAction executes the required methods
 */
function executionAction(&$amfbody)
{
    $specialHandling = $amfbody->getSpecialHandling();
    if (!$amfbody->isSpecialHandling() || $amfbody->isSpecialHandling(array('describeService', 'pageFetch'))) {
        $construct =& $amfbody->getClassConstruct();
        $method = $amfbody->methodName;
        $args = $amfbody->getValue();
        if (isset($construct->methodTable[$method]['fastArray']) && $construct->methodTable[$method]['fastArray'] == true) {
            $amfbody->setMetaData('fastArray', true);
        }
        if ($specialHandling == 'describeService') {
            include_once AMFPHP_BASE . "util/DescribeService.php";
            $ds = new DescribeService();
            $results = $ds->describe($construct, $amfbody->className);
        } else {
            if ($specialHandling == 'pageFetch') {
                $args[count($args) - 2] = $args[count($args) - 2] - 1;
                $dataset = Executive::doMethodCall($amfbody, $construct, $method, $args);
                $results = array("cursor" => $args[count($args) - 2] + 1, "data" => $dataset);
                $amfbody->setMetadata('type', '__DYNAMIC_PAGE__');
            } else {
                if (isset($construct->methodTable[$method]['pagesize'])) {
                    //Check if counting method was overriden
                    if (isset($construct->methodTable[$method]['countMethod'])) {
                        $counter = $construct->methodTable[$method]['countMethod'];
                    } else {
                        $counter = $method . '_count';
                    }
                    $dataset = Executive::doMethodCall($amfbody, $construct, $method, $args);
                    // do the magic
                    $count = Executive::doMethodCall($amfbody, $construct, $counter, $args);
                    //Include the wrapper
                    $results = array('class' => $amfbody->uriClassPath, 'method' => $amfbody->methodName, 'count' => $count, "args" => $args, "data" => $dataset);
                    $amfbody->setMetadata('type', '__DYNAMIC_PAGEABLE_RESULTSET__');
                    $amfbody->setMetadata('pagesize', $construct->methodTable[$method]['pagesize']);
                } else {
                    //The usual
                    $results = Executive::doMethodCall($amfbody, $construct, $method, $args);
                    // do the magic
                }
            }
        }
        if ($results !== '__amfphp_error') {
            $amfbody->setResults($results);
            if (isset($construct->methodTable[$method]['returns']) && !isset($construct->methodTable[$method]['pagesize'])) {
                $amfbody->setMetadata('type', $construct->methodTable[$method]['returns']);
            }
            $amfbody->responseURI = $amfbody->responseIndex . "/onResult";
        }
        return false;
    } else {
        if ($specialHandling == 'pageRelease') {
            //Ignore PageAbleResult.release
            $amfbody->setResults(true);
            $amfbody->setMetaData('type', 'boolean');
            $amfbody->responseURI = $amfbody->responseIndex . "/onResult";
            return false;
        }
    }
    return true;
}