コード例 #1
0
 public function getalluserAction()
 {
     $this->_helper->layout()->disableLayout();
     //params: $folderGuid,$start,$limit,orderBy
     $r = $this->getRequest();
     $q = $r->getParam('q') ? base64_decode($r->getParam('q')) : "1=1";
     $start = $r->getParam('start') ? $r->getParam('start') : 0;
     $limit = $r->getParam('limit') ? $r->getParam('limit') : 0;
     $orderBy = $r->getParam('orderBy') ? $r->getParam('sortBy') : 'firstname';
     $sortOrder = $r->getParam('sortOrder') ? $r->getParam('sortOrder') : ' asc';
     $a = array();
     $tblUser = new Kutu_Core_Orm_Table_User();
     //echo $q;die();
     $rowset = $tblUser->fetchAll($q, 'firstname ASC', $limit, $start);
     if (count($rowset) == 0) {
         $a['catalogs'][0]['guid'] = 'XXX';
         $a['catalogs'][0]['title'] = "No Data";
         $a['catalogs'][0]['subTitle'] = "";
         $a['catalogs'][0]['createdDate'] = '';
         $a['catalogs'][0]['modifiedDate'] = '';
     } else {
         $ii = 0;
         foreach ($rowset as $row) {
             $a['catalogs'][$ii]['guid'] = $row->guid;
             $a['catalogs'][$ii]['title'] = $row->firstname . ' ' . $row->lastname;
             $a['catalogs'][$ii]['subTitle'] = $row->username;
             $a['catalogs'][$ii]['createdDate'] = $row->createdDate;
             $a['catalogs'][$ii]['modifiedDate'] = $row->modifiedDate;
             $ii++;
         }
     }
     echo Zend_Json::encode($a);
     die;
 }
コード例 #2
0
ファイル: User.php プロジェクト: hukumonline/idh
 /**
  * _writeConfirmCorporateEmail
  * @return JSON
  */
 function _writeConfirmCorporateEmail($mailcontent, $fullname, $company, $payment, $disc, $total, $username, $guid, $email)
 {
     $obj = new Kutu_Crypt_Password();
     $mailcontent = str_replace('$fullname', $fullname, $mailcontent);
     $mailcontent = str_replace('$company', $company, $mailcontent);
     $mailcontent = str_replace('$timeline', $payment, $mailcontent);
     $mailcontent = str_replace('$disc', $disc, $mailcontent);
     $mailcontent = str_replace('$price', number_format($total), $mailcontent);
     $mailcontent = str_replace('$username1', $username, $mailcontent);
     $mailcontent = str_replace('$guid', $guid, $mailcontent);
     // table User
     $tblUser = new Kutu_Core_Orm_Table_User();
     $where = $tblUser->getAdapter()->quoteInto('company=?', $company);
     $rowUser = $tblUser->fetchAll($where, 'username ASC');
     $tag = '<table>';
     $tag .= '<tr><td><b>Username</b></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td><b>Password</b></td></tr>';
     foreach ($rowUser as $rowsetUser) {
         $tag .= '<tr><td>' . $rowsetUser->username . '</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>' . $obj->decryptPassword($rowsetUser->password) . '</td></tr>';
     }
     $tag .= '</table>';
     $mailcontent = str_replace('$tag', $tag, $mailcontent);
     $mail_body = $mailcontent;
     // parse ini_file
     $config = new Zend_Config_Ini(KUTU_ROOT_DIR . '/application/configs/mail.ini', 'mail');
     $mailAttempt = $this->add_mail($config->mail->sender->support->email, $email, $username, $config->mail->sender->support->name, $mail_body);
     // try to save mail before send
     if ($mailAttempt) {
         $sendAttempt = $this->send_mail();
         if ($sendAttempt) {
             $message = "Please check your email at {$email}!";
             // update user
             $rowUser = $tblUser->find($obj->decryptPassword($guid))->current();
             if ($rowUser) {
                 $rowUser->isEmailSent = 'Y';
                 $rowUser->save();
             }
         } else {
             $message = "Error send mail but register user successfully!<br>Please contact our customer service for more information";
         }
     } else {
         $message = "Error saving mail!";
     }
     return $message;
 }
コード例 #3
0
ファイル: Formater.php プロジェクト: psykomo/kutump-enhanced
 function _writeConfirmCorporateEmail($mailcontent, $company, $payment, $disc, $total, $username, $guid, $email)
 {
     $formater = new Kutu_Lib_Formater();
     $obj = new Kutu_Crypt_Password();
     $mailcontent = str_replace('$company', $company, $mailcontent);
     $mailcontent = str_replace('$timeline', $payment, $mailcontent);
     $mailcontent = str_replace('$disc', $disc, $mailcontent);
     $mailcontent = str_replace('$price', number_format($total), $mailcontent);
     $mailcontent = str_replace('$username1', $username, $mailcontent);
     $mailcontent = str_replace('$guid', $guid, $mailcontent);
     // table User
     $tblUser = new Kutu_Core_Orm_Table_User();
     $where = $tblUser->getAdapter()->quoteInto('company=?', $company);
     $rowUser = $tblUser->fetchAll($where, 'username ASC');
     $tag = '<table>';
     $tag .= '<tr><td><b>Username</b></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td><b>Password</b></td></tr>';
     foreach ($rowUser as $rowsetUser) {
         $tag .= '<tr><td>' . $rowsetUser->username . '</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>' . $obj->decryptPassword($rowsetUser->password) . '</td></tr>';
     }
     $tag .= '</table>';
     $mailcontent = str_replace('$tag', $tag, $mailcontent);
     $mail_body = $mailcontent;
     // parse ini_file
     $config = new Zend_Config_Ini(KUTU_ROOT_DIR . '/app/config/config.ini', 'mail');
     $mailAttempt = $formater->add_mail($config->from, $email, $username, 'Hukumonline-ID', $mail_body);
     // try to save mail before send
     if ($mailAttempt) {
         $sendAttempt = $formater->send_mail();
         if ($sendAttempt) {
             $response['success'] = true;
             $response['message'] = "Please check your email at {$email}!";
         } else {
             ob_clean();
             $response['failure'] = false;
             $response['message'] = "Error send mail but register user successfully!<br>Please contact our customer service for more information";
         }
     } else {
         $response['failure'] = true;
         $response['message'] = "Error saving mail!";
     }
     echo Zend_Json::encode($response);
 }