本文整理汇总了PHP中Subject类的典型用法代码示例。如果您正苦于以下问题:PHP Subject类的具体用法?PHP Subject怎么用?PHP Subject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Subject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: enrollSection
public function enrollSection()
{
$sectionCode = SectionCode::where('code', Input::get('code'))->first();
if (isset($sectionCode->_id)) {
$section = Subject::find($sectionCode->subject_id)->sections()->find($sectionCode->section_id);
$message = "";
if (strcasecmp($section->current_code, $sectionCode->code) === 0) {
$codes = SectionCode::where('code', Input::get('code'))->whereIn('students_id', array(Auth::id()))->first();
if (!isset($codes->_id)) {
$pending = new PendingEnrollment();
$pending->section_code_id = new MongoId($sectionCode->_id);
$pending->student_id = Auth::id();
$pending->teacher_id = new MongoId($sectionCode->teacher_id);
try {
$pending->save();
} catch (MongoDuplicateKeyException $e) {
return Redirect::back()->withErrors(array('error' => Lang::get('register_group.enroll_pending')));
}
return Redirect::to(Lang::get('routes.enroll_section'))->with('message', Lang::get('register_group.enroll_sucess'));
} else {
$message = Lang::get('register_group.user_register');
}
} else {
$message = Lang::get('register_group.code_expired');
}
} else {
$message = Lang::get('register_group.code_fail');
}
return Redirect::back()->withErrors(array('error' => $message));
}
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:30,代码来源:PendingEnrollmentController.php
示例17: actionMore
public function actionMore()
{
Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/css/enjoy.css');
$city_id = Yii::app()->request->getQuery('city', 0);
$time_sort = Yii::app()->request->getQuery('time_sort', 'DESC');
$price_sort = Yii::app()->request->getQuery('lp_dol');
$criteria = new CDbCriteria();
$criteria->order = 'id DESC';
if (!empty($city_id)) {
$criteria->addCondition('city_id=' . $city_id);
}
if (!empty($time_sort)) {
$criteria->order = 'accessDate ' . $time_sort;
}
if (!empty($price_sort)) {
$criteria->order = 'lp_dol ' . $price_sort;
}
$criteria->addCondition('lp_dol>3000000');
$count = House::model()->count($criteria);
$pager = new CPagination($count);
$pager->pageSize = 10;
$pager->applyLimit($criteria);
$house_list = House::model()->findAll($criteria);
$subject_list = Subject::model()->findAll(array('order' => 'id DESC'));
$cur_city = City::model()->findByPk($city_id);
$data = array('house_list' => $house_list, 'subject_list' => $subject_list, 'cur_city' => $cur_city, 'count' => $count, 'time_sort' => $time_sort, 'price_sort' => $price_sort, 'pages' => $pager);
$this->render('more', $data);
}
开发者ID:zywh,项目名称:maplecity,代码行数:28,代码来源:EnjoyController.php
示例18: showDashboard
public function showDashboard()
{
$data = [];
$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;
//Cards value
$data['students'] = Student::where('collegeid', '=', $collegeid)->count();
$data['teachers'] = Teacher::where('collegeid', '=', $collegeid)->count();
$data['subjects'] = Subject::where('collegeid', '=', $collegeid)->count();
$data['parents'] = $data['students'] * 2;
return View::make('pages.dashboard', array('data' => $data, 'flag' => $flag));
}
开发者ID:pankaja455,项目名称:WebSchool,代码行数:31,代码来源:HomeController.php
示例19: actionTeacher
public function actionTeacher()
{
if (isset($_GET["id"])) {
$id = StringHelper::filterString($_GET["id"]);
$spCriteria = new CDbCriteria();
$spCriteria->select = "*";
$spCriteria->condition = "teacher_id = :teacher_id";
$spCriteria->params = array(':teacher_id' => $id);
$teacher_current_id = Teacher::model()->findAll($spCriteria);
$subject_teacher = Subject::model()->with(array('subject_teacher' => array('select' => false, 'condition' => 'teacher_id = :teacher_id', 'params' => array(':teacher_id' => $id))))->findAll();
$ratingCriteria = new CDbCriteria();
$ratingCriteria->select = "*";
$ratingCriteria->condition = "teacher_id = :teacher_id";
$ratingCriteria->params = array(":teacher_id" => $id);
$rating = Votes::model()->findAll($ratingCriteria);
$count = count($rating);
if ($teacher_current_id) {
foreach ($teacher_current_id as $detail) {
$title = $detail->teacher_acadamic_title . " " . $detail->teacher_name . "| Bluebee - UET";
$image = $detail->teacher_avatar;
$des = $detail->teacher_description;
$this->pageTitle = $title;
Yii::app()->clientScript->registerLinkTag("image_src", "image/jpeg", $image);
Yii::app()->clientScript->registerMetaTag($title, null, null, array('property' => 'og:title'));
Yii::app()->clientScript->registerMetaTag($image, null, null, array('property' => 'og:image'));
Yii::app()->clientScript->registerMetaTag($des, null, null, array('property' => 'og:description'));
}
$this->render('teacher', array('teacher_detail_info' => Teacher::model()->findAll($spCriteria), 'subject_teacher' => $subject_teacher, 'countVote' => $count));
}
}
}
开发者ID:huynt57,项目名称:bluebee-uet.com,代码行数:31,代码来源:ShareController.php
示例20: addSectionCode
public function addSectionCode()
{
$section_code = new SectionCode();
$teacher = Teacher::find(Auth::Id());
$subject_id = Input::get('subject');
$section_id = Input::get('section');
$current_period = Input::get('current_period');
$section_code->teacher_id = new MongoId($teacher->_id);
$section_code->subject_id = new MongoId($subject_id);
$section_code->section_id = new MongoId($section_id);
$section_code->current_period = $current_period;
$section_code->teamleaders_id = array();
$section_code->students_id = array();
$section_code->status = true;
$subject = Subject::find($subject_id);
$section = $subject->sections()->find($section_id);
$code = $this->getInitialLetters($subject->name) . '-' . $section->code . '-' . $current_period;
$section_code->code = $code;
if (!is_null($section->current_code)) {
$sectionCode = SectionCode::where('code', $section->current_code)->first();
if (isset($sectionCode->_id)) {
$sectionCode->status = false;
$sectionCode->save();
}
}
try {
$section_code->save();
$section->current_code = $code;
$section->save();
} catch (MongoDuplicateKeyException $e) {
return Redirect::back()->withErrors(array('error' => Lang::get('section_codes.duplicate_code')));
}
return Redirect::to(Lang::get('routes.section_codes'))->with(array('message' => Lang::get('section_codes.success_message')));
}
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:34,代码来源:SectionCodeController.php
注:本文中的Subject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论