• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Classes类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Classes的典型用法代码示例。如果您正苦于以下问题:PHP Classes类的具体用法?PHP Classes怎么用?PHP Classes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Classes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
         }
     }
 }
开发者ID:mongular,项目名称:mongular,代码行数:14,代码来源:Mongular.php


示例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();
    }
}
开发者ID:GoPlaceIn,项目名称:siacc,代码行数:14,代码来源:ajaxdel.php


示例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;
 }
开发者ID:gpuenteallott,项目名称:rox,代码行数:36,代码来源:apps.lib.php


示例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));
 }
开发者ID:pankaja455,项目名称:WebSchool,代码行数:35,代码来源:ParentController.php


示例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();
 }
开发者ID:JoffreyO,项目名称:hackademic,代码行数:26,代码来源:class.ClassMembershipsController.php


示例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;
 }
开发者ID:gpuenteallott,项目名称:rox,代码行数:15,代码来源:classes.autoload.php


示例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);
 }
开发者ID:vivekjaiswal90,项目名称:schoolopedia,代码行数:11,代码来源:UserClassController.php


示例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;
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:10,代码来源:Classes.php


示例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) {
     }
 }
开发者ID:ramazanalic,项目名称:open-school-timetable,代码行数:11,代码来源:Teacher.php


示例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;
 }
开发者ID:JoffreyO,项目名称:hackademic,代码行数:11,代码来源:class.ClassMemberships.php


示例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;
 }
开发者ID:znframework,项目名称:znframework,代码行数:12,代码来源:Info.php


示例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);
         }
     }
 }
开发者ID:patrickdamery,项目名称:module-system,代码行数:12,代码来源:TimetableController.php


示例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();
    }
}
开发者ID:GoPlaceIn,项目名称:siacc,代码行数:30,代码来源:actgravaclasse.php


示例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;
 }
开发者ID:Refuge89,项目名称:FreedomCore,代码行数:13,代码来源:Classes.FreedomCore.php


示例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.');
     }
 }
开发者ID:mongular,项目名称:mongular,代码行数:17,代码来源:Parameters.php


示例16: getClassesSelectArray

 /**
  * 取得班級資料(提供給select用)
  */
 public static function getClassesSelectArray($hasNone = true)
 {
     if ($hasNone == true) {
         $classesSelectArray[0] = '無';
     }
     $classes = Classes::orderBy('classes_name')->get();
     foreach ($classes as $classItem) {
         $string = $classItem->classes_name;
         if ($teacher = $classItem->teacher) {
             $string .= '(' . $teacher->teacher_name . ')';
         }
         $classesSelectArray[$classItem->classes_id] = $string;
     }
     return $classesSelectArray;
 }
开发者ID:ramazanalic,项目名称:open-school-timetable,代码行数:18,代码来源:Classes.php


示例17: go

 public function go()
 {
     $this->setViewTemplate("rankings.tpl");
     if ($this->isLoggedIn()) {
         $username = $this->getLoggedInUser();
         if (Session::isAdmin() || Session::isTeacher()) {
             $classes = Classes::getAllClasses();
         } else {
             $user = User::findByUserName($username);
             $classes = ClassMemberships::getMembershipsOfUserObjects($user->id);
         }
         $this->addToView('classes', $classes);
     }
     if (!isset($_GET["class"]) || $_GET["class"] == "") {
         $rankings = ChallengeAttempts::getUniversalRankings();
     } else {
         $class_id = $_GET["class"];
         $class = Classes::getClass($class_id);
         if (!$class) {
             $this->addErrorMessage("Not a valid class");
             return $this->generateView();
         } else {
             $rankings = ChallengeAttempts::getClasswiseRankings($class_id);
         }
     }
     $final = array();
     $counter = 1;
     $rank = 1;
     $rankcount = 1;
     $prevcount = null;
     foreach ($rankings as $ranking) {
         if ($counter != 1 && $prevcount == $ranking['count']) {
             $rank = $rankcount;
             $rankcount++;
         }
         if ($counter != 1 && $prevcount != $ranking['count']) {
             $rankcount++;
             $rank = $rankcount;
         }
         $prevcount = $ranking['count'];
         $counter++;
         $temp = array('user_id' => $ranking['user_id'], 'time' => $ranking['time'], 'count' => $ranking['count'], 'username' => $ranking['username'], 'rank' => $rank);
         array_push($final, $temp);
     }
     $this->addToView('rankings', $final);
     return $this->generateView();
 }
开发者ID:JoffreyO,项目名称:hackademic,代码行数:47,代码来源:class.RankingsController.php


示例18: loadModules

 public function loadModules()
 {
     if (!isset($this->_moduleDir)) {
         return false;
     }
     $Classes = Classes::get();
     $dir = dir($this->_moduleDir);
     while ($d = $dir->read()) {
         if ($d == '.' || $d == '..') {
             continue;
         }
         $dp = $dir->path . '/' . $d;
         if (!is_dir($dp)) {
             continue;
         }
         if (!file_exists($dp . '/module.xml')) {
             continue;
         }
         $d = @DOMDocument::load($dp . '/module.xml');
         if (!$d) {
             continue;
         }
         $d->XPath = new DOMXPath($d);
         $moduleName = $d->XPath->query('/module/moduleName');
         if ($moduleName->length != 1) {
             throw new PException('Module load error in "' . $dp . '/module.xml"!');
         }
         $moduleFiles = $d->XPath->query('/module/moduleFiles');
         if ($moduleFiles->length != 1) {
             throw new PException('Module load error in "' . $dp . '/module.xml"!');
         }
         foreach ($moduleFiles->item(0)->childNodes as $node) {
             if (!is_a($node, 'DOMElement')) {
                 continue;
             }
             foreach ($node->childNodes as $file) {
                 if (!is_a($file, 'DOMElement')) {
                     continue;
                 }
                 if ($file->hasAttribute('class')) {
                     $Classes->addClass($file->getAttribute('class'), $dp . '/' . $node->nodeName . '/' . $file->nodeValue);
                 }
             }
         }
         $this->_modules[$moduleName->item(0)->nodeValue] = $d;
     }
 }
开发者ID:gpuenteallott,项目名称:rox,代码行数:47,代码来源:modules.lib.php


示例19: draw

 function draw()
 {
     global $display;
     $keyword = Url::get('keyword');
     if (!$keyword) {
         $keyword = Url::get('keyword_mobile');
     }
     $order_str = '';
     $where_class = ' WHERE `name` LIKE "%' . addslashes($keyword) . '%"  AND is_active = 1 ';
     $where_subject = ' WHERE `name` LIKE "%' . addslashes($keyword) . '%"   ';
     $where_lesson = ' WHERE `name` LIKE "%' . addslashes($keyword) . '%"   ';
     $per_page = 21;
     $list_class = Classes::get_collection(' LIMIT 0, ' . $per_page, $where_class, $order_str);
     $list_subject = Subjects::get_collection(' LIMIT 0, ' . $per_page, $where_subject, $order_str);
     $list_lesson = Lessons::get_collection(' LIMIT 0, ' . $per_page, $where_lesson, $order_str);
     $current_url = strtok($_SERVER['REQUEST_URI'], '&');
     if (count($list_class) == $per_page) {
         $is_next_class = 1;
         array_pop($list_class);
     } else {
         $is_next_class = 0;
     }
     if (count($list_subject) == $per_page) {
         $is_next_subject = 1;
         array_pop($list_subject);
     } else {
         $is_next_subject = 0;
     }
     if (count($list_lesson) == $per_page) {
         $is_next_lesson = 1;
         array_pop($list_lesson);
     } else {
         $is_next_lesson = 0;
     }
     $display->add('current_url', $current_url);
     $display->add('is_next_class', $is_next_class);
     $display->add('is_next_subject', $is_next_subject);
     $display->add('is_next_lesson', $is_next_lesson);
     $display->add('list_class', $list_class);
     $display->add('list_subject', $list_subject);
     $display->add('list_lesson', $list_lesson);
     $display->add('keyword_view', htmlspecialchars($keyword));
     $display->add('keyword', $keyword);
     $display->add('keyword_mobile', $keyword);
     // Output
     $display->output("list");
 }
开发者ID:hqd276,项目名称:bigs,代码行数:47,代码来源:list.php


示例20: go

 public function go()
 {
     $this->setViewTemplate('showclass.tpl');
     if (!isset($_GET['id'])) {
         header('Location: ' . SOURCE_ROOT_PATH . "admin/pages/manageclass.php");
     }
     $class_id = $_GET['id'];
     if (isset($_POST['submit'])) {
         if (isset($_POST['updateclassname'])) {
             if ($_POST['updateclassname'] == '') {
                 header('Location: ' . SOURCE_ROOT_PATH . "admin/pages/showclass.php?id={$class_id}&action=editerror");
             } else {
                 $this->name = $_POST['updateclassname'];
                 Classes::updateClassName($class_id, $this->name);
                 header('Location: ' . SOURCE_ROOT_PATH . "admin/pages/showclass.php?id={$class_id}&action=editsuccess");
             }
         }
     }
     if (isset($_GET['action']) && $_GET['action'] == "editerror") {
         $this->addErrorMessage("Class name should not be empty");
     }
     if (isset($_GET['action']) && $_GET['action'] == "editsuccess") {
         $this->addSuccessMessage("Class name updated successfully");
     }
     if (isset($_GET['action']) && $_GET['action'] == "del") {
         if (isset($_GET['uid'])) {
             ClassMemberships::deleteMembership($_GET['uid'], $class_id);
             $this->addSuccessMessage("User has been deleted from the class succesfully");
         } else {
             if (isset($_GET['cid'])) {
                 ClassChallenges::deleteMembership($_GET['cid'], $class_id);
                 $this->addSuccessMessage("Challenge has been deleted from the class succesfully");
             }
         }
     }
     $class = Classes::getClass($class_id);
     $user_members = ClassMemberships::getAllMemberships($class_id);
     $challenges_assigned = ClassChallenges::getAllMemberships($class_id);
     $this->addToView('class', $class);
     $this->addToView('users', $user_members);
     $this->addToView('challenges', $challenges_assigned);
     return $this->generateView();
 }
开发者ID:JoffreyO,项目名称:hackademic,代码行数:43,代码来源:class.ShowClassController.php



注:本文中的Classes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Clean类代码示例发布时间:2022-05-20
下一篇:
PHP ClassTools类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap