当前位置: 首页>>代码示例>>PHP>>正文


PHP Subject类代码示例

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


在下文中一共展示了Subject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delSubject

 function delSubject($id)
 {
     $su = new Subject();
     $condition = '`id`=' . $id;
     $r = $su->subject_delete($condition);
     header('Location:' . $_SERVER['HTTP_REFERER']);
 }
开发者ID:bmchun,项目名称:sunset,代码行数:7,代码来源:subjectview.php

示例2: processRequest

 public function processRequest(MMapRequest $request, MMapResponse $response)
 {
     ob_start('mb_output_handler');
     MMapManager::startSession();
     MMapManager::checkSessionExpiration();
     $username = $request->issetPOST('username') ? $request->getPOST('username') : '';
     $password = $request->issetPOST('password') ? $request->getPOST('password') : '';
     $loginPage = $request->issetPOST('loginPage') ? $request->getPOST('loginPage') : '';
     $subject = new Subject();
     $loginContext = new LoginContext('eyeos-login', $subject);
     $cred = new EyeosPasswordCredential();
     $cred->setUsername($username);
     $cred->setPassword($password, true);
     $subject->getPrivateCredentials()->append($cred);
     try {
         $loginContext->login();
         $memoryManager = MemoryManager::getInstance();
         Kernel::enterSystemMode();
         $memoryManager->set('isExternLogin', 1);
         $memoryManager->set('username', $username);
         $memoryManager->set('password', $password);
         $memoryManager->set('loginPage', $loginPage);
         Kernel::exitSystemMode();
         header("Location: index.php");
     } catch (Exception $e) {
         header("Location:" . $loginPage . "?errorLogin=1");
     }
 }
开发者ID:DavidGarciaCat,项目名称:eyeos,代码行数:28,代码来源:MMapExternLogin.php

示例3: actionCreate

 /**
  * 录入
  *
  */
 public function actionCreate()
 {
     parent::_acl('subject_create');
     $model = new Subject();
     $imageList = $this->_gets->getPost('imageList');
     $layoutList = $this->_gets->getPost('layoutList');
     $imageListSerialize = XUtils::imageListSerialize($imageList);
     $layoutListSerialize = XUtils::imageListSerialize($layoutList);
     if (isset($_POST['Subject'])) {
         $file = XUpload::upload($_FILES['attach']);
         $model->attributes = $_POST['Subject'];
         $model->date = strtotime($_POST['Subject']['date']);
         if (is_array($file)) {
             $model->room_type_image = $file['pathname'];
         }
         $model->image_list = $imageListSerialize['dataSerialize'];
         $model->layout_list = $layoutListSerialize['dataSerialize'];
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入项目,ID:' . $model->id));
             $this->redirect(array('index'));
         }
     }
     $this->city_list = parent::_groupList('city');
     $this->render('create', array('model' => $model, 'imageList' => $imageListSerialize['data'], 'layoutList' => $layoutListSerialize['data']));
 }
开发者ID:zywh,项目名称:maplecity,代码行数:29,代码来源:SubjectController.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     DB::table('propel_fellow_wingman')->delete();
     DB::table('propel_student_wingman')->delete();
     Subject::truncate();
     DB::table('propel_city_subject')->delete();
     CalendarEvent::truncate();
     CancelledCalendarEvent::truncate();
     WingmanModule::truncate();
     WingmanTime::truncate();
     VolunteerTime::truncate();
     WingmanJournal::truncate();
     $fellow = Fellow::find(1);
     $wingman1 = Wingman::find(2);
     $wingman2 = Wingman::find(3);
     $fellow->wingman()->attach($wingman1);
     $fellow->wingman()->attach($wingman2);
     $student1 = Student::find(3);
     $student2 = Student::find(4);
     $wingman1->student()->attach($student1);
     $wingman1->student()->attach($student2);
     $cEvent1 = new CalendarEvent();
     $cEvent1->type = 'volunteer_time';
     $cEvent1->student()->associate($student1);
     $cEvent1->status = 'created';
     $cEvent1->save();
     $vTime1 = new VolunteerTime();
     $vTime1->calendarEvent()->associate($cEvent1);
     $volunteer1 = Volunteer::find(4);
     $vTime1->volunteer()->associate($volunteer1);
     $subject1 = new Subject();
     $subject1->name = "English";
     $subject1->save();
     $vTime1->subject()->associate($subject1);
     $vTime1->save();
     $cEvent2 = new CalendarEvent();
     $cEvent2->type = 'wingman_time';
     $cEvent2->student()->associate($student1);
     $cEvent2->status = 'created';
     $cEvent2->save();
     $wTime1 = new WingmanTime();
     $wTime1->calendarEvent()->associate($cEvent2);
     $wTime1->wingman()->associate($wingman1);
     $wModule1 = new WingmanModule();
     $wModule1->name = "Programming";
     $wModule1->save();
     $wTime1->wingmanModule()->associate($wModule1);
     $wTime1->save();
     $city1 = City::find(1);
     $subject1->city()->attach($city1);
     $wJournal1 = new WingmanJournal();
     $wJournal1->type = 'formal';
     $wJournal1->title = "Day at Navy Camp";
     $wJournal1->mom = "It was awesome";
     $wJournal1->student()->associate($student1);
     $wJournal1->wingman()->associate($wingman1);
     $wJournal1->save();
 }
开发者ID:makeadiff,项目名称:propel,代码行数:64,代码来源:DatabaseSeeder.php

示例5: update

 /**
  * @inheritdoc
  */
 public function update(Subject $subject)
 {
     if ($subject->getState() == 'logged in') {
         $this->sendUserHasLoggedInMail();
     } else {
         $this->sendUserHasLoggedOutMail();
     }
 }
开发者ID:rpodwika,项目名称:designpatterns,代码行数:11,代码来源:AuthMailer.php

示例6: get_names

 public function get_names()
 {
     $temp_subject = new Subject();
     $temp_subject->load($this->subject_id_1);
     $this->subject_1_name = $temp_subject->print_name();
     $temp_subject->load($this->subject_id_2);
     $this->subject_2_name = $temp_subject->print_name();
 }
开发者ID:imonroe,项目名称:coldreader,代码行数:8,代码来源:Relationship_class.php

示例7: send

 /**
  * Сурогат говорит
  *
  * @return string
  */
 public function send()
 {
     // Подключать реальный объект можно и в контролере.
     // Или агригировать его на этапе создания суррогата.
     // Все зависит от конечных целей.
     if ($this->realSubject == null) {
         $this->realSubject = new RealSubject();
     }
     return "<strong>" . $this->realSubject->send() . "</strong>";
 }
开发者ID:AlexanderGrom,项目名称:php-patterns,代码行数:15,代码来源:proxy.php

示例8: processRequest

 public function processRequest(MMapRequest $request, MMapResponse $response)
 {
     $oauth_verifier = null;
     $oauth_token = null;
     if ($request->issetGET('oauth_verifier')) {
         $oauth_verifier = $request->getGET('oauth_verifier');
     }
     if ($request->issetGET('oauth_token')) {
         $oauth_token = $request->getGET('oauth_token');
     }
     if ($oauth_verifier && $oauth_token) {
         $response->getHeaders()->append('Content-type: text/html');
         $body = '<html>
                         <div id="logo_eyeos" style="margin: 0 auto;width:350"> <img src="eyeos/extern/images/logo-eyeos.jpg"/></div>
                         <div style="margin: 0 auto;width:350;text-align:center"><span style="font-family:Verdana;font-size:20px;">Successful authentication.<br>Back to Eyeos.</span></div>
                  </html>';
         $response->getHeaders()->append('Content-Length: ' . strlen($body));
         $response->getHeaders()->append('Accept-Ranges: bytes');
         $response->getHeaders()->append('X-Pad: avoid browser bug');
         $response->getHeaders()->append('Cache-Control: ');
         $response->getHeaders()->append('pragma: ');
         $response->setBody($body);
         try {
             $userRoot = UMManager::getInstance()->getUserByName('root');
         } catch (EyeNoSuchUserException $e) {
             throw new EyeFailedLoginException('Unknown user root"' . '". Cannot proceed to login.', 0, $e);
         }
         $subject = new Subject();
         $loginContext = new LoginContext('eyeos-login', $subject);
         $cred = new EyeosPasswordCredential();
         $cred->setUsername('root');
         $cred->setPassword($userRoot->getPassword(), false);
         $subject->getPrivateCredentials()->append($cred);
         $loginContext->login();
         Kernel::enterSystemMode();
         $appProcess = new Process('stacksync');
         $appProcess->setPid('31338');
         $mem = MemoryManager::getInstance();
         $processTable = $mem->get('processTable', array());
         $processTable[31338] = $appProcess;
         $mem->set('processTable', $processTable);
         $appProcess->setLoginContext($loginContext);
         ProcManager::getInstance()->setCurrentProcess($appProcess);
         kernel::exitSystemMode();
         $token = new stdClass();
         $token->oauth_verifier = $oauth_verifier;
         $token->oauth_token = $oauth_token;
         $group = UMManager::getInstance()->getGroupByName('users');
         $users = UMManager::getInstance()->getAllUsersFromGroup($group);
         foreach ($users as $user) {
             $NetSyncMessage = new NetSyncMessage('cloud', 'token', $user->getId(), $token);
             NetSyncController::getInstance()->send($NetSyncMessage);
         }
     }
 }
开发者ID:sebasalons,项目名称:eyeos-u1db,代码行数:55,代码来源:MMapStacksync.php

示例9: update

 public function update(Subject $subject)
 {
     //doing action when user is logged
     if ($subject->getState() == 'logged in') {
         $this->logUserHasLoggedIn();
     } else {
         if ($subject->getState() == 'logged out') {
             $this->logUserHasLoggedOut();
         }
     }
 }
开发者ID:rpodwika,项目名称:designpatterns,代码行数:11,代码来源:AuthLogging.php

示例10: match

 public function match(Subject $subject)
 {
     $em = $this->getEntityManager();
     $query = $em->createQuery('Select IDENTITY(s.user)
         From SubwayBuddyUserBundle:Subject s
         WHERE s.subject = ?1
         AND s.user != ?2');
     $query->setParameter(1, $subject->getSubject());
     $query->setParameter(2, $subject->getUser());
     return $query->getResult();
 }
开发者ID:ChristianHiroz,项目名称:SubwayBuddy,代码行数:11,代码来源:SubjectRepository.php

示例11: save

 public function save()
 {
     $subjectId = $this->getValue('subjectId');
     if (!empty($subjectId)) {
         $subject = $this->getSubjectService()->getSubjectById($subjectId);
     } else {
         $subject = new Subject();
     }
     $subject->setCode($this->getValue('code'));
     $subject->setName($this->getValue('name'));
     $subject->save();
 }
开发者ID:andgatetech,项目名称:hrm,代码行数:12,代码来源:SubjectForm.php

示例12: testUpdateIsCalledOnce

 /**
  * @group fakeobject
  */
 public function testUpdateIsCalledOnce()
 {
     // 建立一個 Observer 的 Mock Object
     $observer = $this->getMock('Observer');
     // 預期 Observer::update 方法應該只跑一次
     // 而傳入 update 方法的參數值為 something
     $observer->expects($this->once())->method('update')->with($this->equalTo('something'));
     $subject = new Subject();
     $subject->attach($observer);
     // 我們預測這裡會呼叫 Observer::update() 一次
     $subject->doSomething();
 }
开发者ID:YidaChen,项目名称:tutorial-php-advenced,代码行数:15,代码来源:MockTest.php

示例13: testAllPolicyEvaluateAllAny

 /**
  * Test the evaluation of all policies when no policy name is given
  */
 public function testAllPolicyEvaluateAllAny()
 {
     $set = PolicySet::instance()->add('policy1', Policy::instance()->hasUsername('ccornutt'));
     $user = (object) ['username' => 'ccornutt'];
     $subject = new Subject($user);
     $subject->setAuth(true);
     $context = new Context(['policies' => $set]);
     $gateway = new Gateway($subject, $context);
     // Evaluate the result of the policy above, true because they're:
     //  1. set correctly, 2. policy passes
     $result = $gateway->evaluate();
     $this->assertTrue($result);
 }
开发者ID:psecio,项目名称:propauth,代码行数:16,代码来源:GatewayTest.php

示例14: testLogin

 public function testLogin()
 {
     $subject = new Subject();
     $sharedState = new ArrayList();
     $options = array();
     /**** wrong password ****/
     $cred = new EyeosPasswordCredential();
     $cred->setUsername('userLogin0');
     $cred->setPassword('wrongPass', true);
     $subject->getPrivateCredentials()->append($cred);
     $this->fixture->initialize($subject, $sharedState, $options);
     try {
         $this->fixture->login();
         $this->fail();
     } catch (EyeLoginException $e) {
         // normal situation
     }
     $this->assertEquals(1, $subject->getPrivateCredentials()->count());
     $subject->getPrivateCredentials()->remove($cred);
     $this->assertEquals(0, $subject->getPrivateCredentials()->count());
     /**** nonexisting user ****/
     $cred = new EyeosPasswordCredential();
     $cred->setUsername('john');
     $cred->setPassword('userPassword0', true);
     $subject->getPrivateCredentials()->append($cred);
     $this->fixture->initialize($subject, $sharedState, $options);
     try {
         $this->fixture->login();
         $this->fail();
     } catch (EyeLoginException $e) {
         // normal situation
     }
     $this->assertEquals(1, $subject->getPrivateCredentials()->count());
     $subject->getPrivateCredentials()->remove($cred);
     $this->assertEquals(0, $subject->getPrivateCredentials()->count());
     /**** no password credential ****/
     $this->fixture->initialize($subject, $sharedState, $options);
     try {
         $this->fixture->login();
         $this->fail();
     } catch (EyeLoginException $e) {
         // normal situation
     }
     /**** good login/pass ****/
     $cred = new EyeosPasswordCredential();
     $cred->setUsername('userLogin0');
     $cred->setPassword('userPassword0', true);
     $subject->getPrivateCredentials()->append($cred);
     $this->fixture->initialize($subject, $sharedState, $options);
     $this->assertTrue($this->fixture->login());
 }
开发者ID:DavidGarciaCat,项目名称:eyeos,代码行数:51,代码来源:EyeosSQLLoginModuleTest.php

示例15: format

 public static function format($data)
 {
     $uids = $sids = [];
     $users = $subjects = [];
     foreach ($data as $d) {
         $uids[] = $d->userid;
         $sids[] = $d->subject_id;
     }
     $uids = array_unique($uids);
     $ret = \User::find([['userid' => ['$in' => $uids]]]);
     foreach ($ret as $u) {
         $users[$u->userid] = $u->attrs();
     }
     $sids = array_unique($sids);
     $ret = \Subject::find([['id' => ['$in' => $sids]]]);
     foreach ($ret as $s) {
         $subjects[$s->id] = $s->attrs();
     }
     $ret = [];
     foreach ($data as $d) {
         $ret[] = ['id' => $d->id, 'saying' => $d->saying, 'imgs' => $d->imgs, 'author' => $users[$d->userid], 'subject' => $subjects[$d->subject_id], 'created_at' => $d->created_at];
     }
     return $ret;
     print_r($users);
     print_r($subjects);
     print_r($uids);
     print_r($sids);
     return [];
 }
开发者ID:nisnaker,项目名称:tu,代码行数:29,代码来源:Photo.php


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