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


PHP Teacher::get_by_person方法代码示例

本文整理汇总了PHP中Teacher::get_by_person方法的典型用法代码示例。如果您正苦于以下问题:PHP Teacher::get_by_person方法的具体用法?PHP Teacher::get_by_person怎么用?PHP Teacher::get_by_person使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Teacher的用法示例。


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

示例1: testRemembersPerson

 function testRemembersPerson()
 {
     $fakename = 'Bob Dobalina';
     $p = new Person(array('id' => 4, 'name' => $fakename));
     $x = Teacher::get_by_person($p);
     $this->assertEquals(1, $x->id);
     $this->assertEquals($fakename, $x->name());
 }
开发者ID:songwork,项目名称:songwork,代码行数:8,代码来源:testTeacher.php

示例2: isset

}
########### IDENTIFICATION
$p = Person::get_by_cookie();
# lopass interception: http://songwork.com/home/1234/ab8f
# not full auth, only to have existing client's name & address pre-filled from database for forms
if ($p === false && isset($_SERVER['PATH_INFO']) && preg_match('/\\/(\\d*)\\/([0-9a-zA-Z]{4})$/', $_SERVER['PATH_INFO'], $matches)) {
    $possible_id = $matches[1];
    $possible_lopass = $matches[2];
    $pp = Person::get_by_id_lopass($possible_id, $possible_lopass);
    if ($pp !== false) {
        $pp->set_welcome_cookie();
        $p = $pp;
    }
}
$student = Student::get_by_person($p);
$teacher = Teacher::get_by_person($p);
$admin = Administrator::get_by_person($p);
$qv['p'] = $p;
$qv['student'] = $student;
$qv['teacher'] = $teacher;
$qv['admin'] = $admin;
$currency = 'USD';
# TODO: dynamic. set in Person?
$qv['currency'] = $currency;
# name / email - FOR PRE-FILLING FORMS AND HEADERS
if ($p) {
    $qv['name'] = $p->name();
    $qv['email'] = $p->email();
} else {
    $qv['name'] = isset($_COOKIE['name']) ? $_COOKIE['name'] : '';
    $qv['email'] = isset($_COOKIE['email']) ? $_COOKIE['email'] : '';
开发者ID:songwork,项目名称:songwork,代码行数:31,代码来源:songwork-init.php


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