本文整理汇总了PHP中Classes类的典型用法代码示例。如果您正苦于以下问题:PHP Classes类的具体用法?PHP Classes怎么用?PHP Classes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Classes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
/**
* @throws \Exception
*/
private function postProcess()
{
foreach ($this->config->PostProcessors as $processor) {
if (Classes::validateProcessor($processor)) {
$process = Factory::build($processor);
$process->process($this);
} else {
throw new \Exception('Mongular: Attempt to access invalid processor ' . $this->request);
}
}
}
示例2: fntDeletaClassePergunta
function fntDeletaClassePergunta()
{
try {
$t = new Classes();
$t->setCodigo(base64_decode($_POST['id']));
if ($t->DeletarClassePergunta()) {
echo Comuns::Idioma("@lng[Classificação de exercício excluída com sucesso.]");
} else {
echo Comuns::Idioma("@lng[Não foi possível excluír a classificação de exercícios.] " . $t->getErro());
}
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
示例3: _doBuild
/**
* load all app files for given path and build.xml document
*
* @param string $path app base path
* @param DOMDocument $build build.xml
* @return boolean
*/
private function _doBuild($path, DOMDocument $build)
{
$Classes = Classes::get();
$x = new DOMXPath($build);
$app = $x->query('/build/app');
if ($app->length != 1) {
throw new PException('App error!');
}
$app = $app->item(0);
if (!$app->hasAttribute('name')) {
throw new PException('App name error!');
}
$this->_apps[$app->getAttribute('name')] = $build;
$files = $x->query('/build/files/file');
foreach ($files as $file) {
if ($file->hasAttribute('class')) {
$Classes->addClass($file->getAttribute('class'), $path . $file->nodeValue);
continue;
}
if ($file->hasAttribute('include')) {
if (!file_exists($path . $file->nodeValue)) {
continue;
}
$this->_includes[] = $path . $file->nodeValue;
continue;
}
}
return true;
}
示例4: showParent
public function showParent()
{
$data = array();
$loginid = Session::get('user')->id;
$collegeid = Session::get('user')->collegeid;
$flag = Session::get('user')->flag;
$tb = "";
if ($flag == 1) {
$tb = "Admin";
} else {
if ($flag == 2) {
$tb = "Teacher";
} else {
if ($flag == 3) {
$tb = "Student";
} else {
$tb = "Staff";
}
}
}
$dt = $tb::where('loginid', '=', $loginid)->first();
$data['name'] = $dt->name;
$data['pic'] = $dt->profilepic;
$data['id'] = $loginid;
$colid = Session::get('user')->collegeid;
//$colid = "bt123";
$classes = Classes::where('collegeid', '=', $colid)->get();
$data['class'] = [];
$i = 0;
for ($i = 0; $i < sizeof($classes); $i++) {
$data['class'][$i]['id'] = $classes[$i]->id;
$data['class'][$i]['name'] = $classes[$i]->classname;
}
return View::make('pages.parent', array('data' => $data, 'flag' => $flag));
}
示例5: go
public function go()
{
$this->setViewTemplate('classmembership.tpl');
$user_id = $_GET['id'];
$user = User::getUser($user_id);
if (isset($_POST['submit'])) {
$class_id = $_POST['class_id'];
if (ClassMemberships::doesMembershipExist($user_id, $class_id)) {
$this->addErrorMessage("User is already a member of this class");
} else {
ClassMemberships::addMembership($user_id, $class_id);
$this->addSuccessMessage("User has been added to the class succesfully");
}
} elseif (isset($_GET['action']) && $_GET['action'] == "del") {
$class_id = $_GET['class_id'];
ClassMemberships::deleteMembership($user_id, $class_id);
$this->addSuccessMessage("User has been deleted from the class succesfully");
}
$class_memberships = ClassMemberships::getMembershipsOfUser($user_id);
$classes = Classes::getAllClasses();
$this->addToView('classes', $classes);
$this->addToView('class_memberships', $class_memberships);
$this->addToView('user', $user);
$this->setViewTemplate('classmembership.tpl');
$this->generateView();
}
示例6: singleton
/**
* The singleton method
*
* alias for Classes::get()
*
* @return Classes
*/
public static function singleton()
{
if (!isset(self::$_instance)) {
$c = __CLASS__;
self::$_instance = new $c();
}
return self::$_instance;
}
示例7: postGetClassesFromStreamId
/**
* Api for getting Classes by Stream Id
*/
public function postGetClassesFromStreamId()
{
$stream_id = Input::get('stream_id');
$school_id = Sentry::getUser()->school_id;
$classes = Classes::where('streams_id', '=', $stream_id)->where('school_id', '=', $school_id)->get();
$response = array('status' => 'success', 'result' => array('classes' => $classes));
return Response::json($response);
}
示例8: getDataFormatted
protected static function getDataFormatted($data)
{
$personFormatted = array();
if (is_array($data)) {
foreach ($data as $k => $person) {
$personFormatted[$k] = Classes::formatData($person);
}
}
return $personFormatted;
}
示例9: syncClasses
public static function syncClasses()
{
$teacher = Teacher::find(self::$lastTeacherId);
try {
$classes = Classes::where('teacher_id', '=', $teacher->teacher_id)->update(array('teacher_id' => 0));
if ($teacher->classes_id > 0) {
$classes = Classes::find($teacher->classes_id)->update(array('teacher_id' => $teacher->teacher_id));
}
} catch (Exception $e) {
}
}
示例10: getMembershipsOfUserObjects
public static function getMembershipsOfUserObjects($user_id)
{
$classes = self::getMembershipsOfUser($user_id);
$object_array = array();
foreach ($classes as $class) {
$temp = array('id' => $class['class_id'], 'name' => $class['name']);
$obj = Classes::instantiate($temp);
array_push($object_array, $obj);
}
return $object_array;
}
示例11: _is
protected function _is($type, $file)
{
$file = $this->rpath($file);
$validType = $this->methods[$type] ?? NULL;
if (!function_exists($validType) || $validType === NULL) {
die(getErrorMessage('Error', 'undefinedFunction', Classes::onlyName(get_called_class()) . '::' . $type . '()'));
}
if ($validType($file)) {
return true;
}
return false;
}
示例12: postSaveTimetable
public function postSaveTimetable()
{
if (Request::ajax()) {
$class = Classes::find(Input::get('id'));
$times = Input::get('time');
$times = substr($times, 1, -1);
$class->classtimes = $times;
if ($class->save()) {
return Response::json('success', 200);
}
}
}
示例13: Main
function Main()
{
$cod = $_POST["c"];
$des = urldecode($_POST["d"]);
$com = urldecode($_POST["com"]);
header('Content-Type: text/html; charset=iso-8859-1');
try {
$c = new Classes();
if ($cod != "") {
$c->setCodigo($cod);
}
if ($des != "") {
$c->setDescricao($des);
}
if ($com != "") {
$c->setComplemento($com);
}
if ($cod == "") {
if ($c->AdicionarClassePergunta()) {
echo "GRAVADO";
}
} else {
if ($c->AtualizaClassePerguntas()) {
echo "GRAVADO";
}
}
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
示例14: GetClass
public static function GetClass($ClassName)
{
$Statement = Classes::$DBConnection->prepare('SELECT * FROM classes WHERE class_name = :class');
$Statement->bindParam(':class', $ClassName);
$Statement->execute();
$Result = $Statement->fetch(PDO::FETCH_ASSOC);
$Result['class_full_name'] = Classes::$TM->GetConfigVars('Class_' . str_replace('-', '_', ucfirst($Result['class_name'])));
$Result['indicator_first_type'] = Classes::$TM->GetConfigVars($Result['indicator_first_type']);
$Result['indicator_second_type'] = Classes::$TM->GetConfigVars($Result['indicator_second_type']);
$Result['can_be_picked_by'] = Classes::RaceClassMatch($ClassName);
$Result['abilities'] = Classes::GetAbilities($ClassName);
return $Result;
}
示例15: __construct
/**
* @throws \Exception
*/
public function __construct()
{
if (isset($_GET['q'])) {
$parameters = explode('/', $_GET['q']);
$this->request = Classes::getControllerRoute(array_shift($parameters));
if (!$this->request) {
throw new \Exception('Mongular: Request not valid.');
}
$this->values = $parameters;
$this->query_parameters = Headers::get('QueryParameters');
} else {
throw new \Exception('Mongular: No valid parameters passed.');
}
}