DataObjects/Core_person_signup.php
[Pman.Core] / DataObjects / Core_person_signup.php
1 <?php
2
3 /**
4  * Table Definition for Person
5  */
6 require_once 'DB/DataObject.php';
7
8 class Pman_Core_DataObjects_Core_person_signup extends DB_DataObject 
9 {
10     ###START_AUTOCODE
11     /* the code below is auto generated do not remove the above tag */
12
13     public $__table = 'core_person_signup';                          // table name
14     public $id;                              // int(11)  not_null primary_key auto_increment
15     public $email;                           // string(128)  not_null
16     public $name;                            // string(128)  not_null
17     public $firstname;                            // string(128)  not_null
18     public $lastname;                            // string(128)  not_null
19     public $firstname_alt;                            // string(128)  not_null
20     public $lastname_alt;                            // string(128)  not_null
21     public $honor;                            // string(128)  not_null
22     public $verify_key;                      // int(11)
23     public $verified;
24     public $created_dt;                      // datetime(19)  binary
25
26 //    function verify($key) 
27 //    {
28 //        // if key matches verify_key
29 //        // copy into person or other entity...
30 //        // and delete....
31 //        if ($this->get("verify_key", $key)) {
32 //            $p = DB_DataObject::factory('person');
33 //            $p->setFrom(array(
34 //                'honor' => $this->honor,
35 //                'name' => $this->name,
36 //                'email' => $this->email,
37 //                'firstname' => $this->firstname,
38 //                'lastname' => $this->lastname,
39 //                'firstname_alt' => $this->firstname_alt,
40 //                'lastname_alt' => $this->lastname_alt));
41 //
42 //            if ($p->insert()) {
43 //
44 //                $temp_pwd = $p->generatePassword();
45 //
46 //                $this->delete();
47 //
48 //                //login
49 //                @session_start();
50 //
51 //                $_SESSION['Hydra']['authUser'] = $p ? serialize($p) : false;
52 //
53 //                //mail pwd
54 //                $c = DB_DataObject::factory('core_email');
55 //                if (!$c->get('name', 'CORE_PERSON_SIGNUP_CONGRATULATION')) {
56 //                    $this->jerr("can not find template");
57 //                }
58 //                $ret = $c->send(array(
59 //                    'rcpts' => $this->email,
60 //                    'honor' => $this->honor . ". " . $this->lastname,
61 //                    'password' => $temp_pwd
62 //                        ), true);
63 //
64 //                if (is_object($ret)) {
65 //                    return false;
66 //                }
67 //                return true;
68 //            } else {
69 //                return false;
70 //            }
71 //        }
72 //        return false;
73 //    }
74 //
75 //    function convertTo($table) 
76 //    {
77 //        $t = DB_DataObject::factory($table);
78 //        $ret = $t->get('email', $this->email);
79 //        if ($ret != 0) {
80 //            return false;
81 //        } else {
82 //            $t->setFrom(array(
83 //                'honor' => $this->honor,
84 //                'name' => $this->name,
85 //                'email' => $this->email,
86 //                'firstname' => $this->firstname,
87 //                'lastname' => $this->lastname,
88 //                'firstname_alt' => $this->firstname_alt,
89 //                'lastname_alt' => $this->lastname_alt));
90 //
91 //            $t->insert();
92 //            return true;
93 //        }
94 //    }
95
96     function sendVerification($roo)
97     {
98         
99         $content = array(
100             'template'      => 'CORE_PERSON_SIGNUP_VERIFICATION',
101             'person'        => $this,
102             'serverName'    => $_SERVER['SERVER_NAME'],
103             'baseURL'       => $roo->baseURL
104         );
105
106         $sent = DB_DataObject::factory('core_email')->send($content);
107         
108         if(!is_object($sent)){
109             return true;
110         }
111         
112         return false;
113     }
114 }
115