/**
  * Set person data
  *
  * @param PersonModel $person
  */
 public function setPerson(PersonModel $person)
 {
     $gender = $person->getGenderString();
     $this->setGender($gender);
     $name = $person->getRealName();
     $this->setRealName($name);
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function __construct($configuration)
 {
     parent::__construct($configuration);
     $this->email = $configuration['email'];
     $this->dateAdded = new \DateTime($configuration['date_added']);
     $this->person = PersonModel::create($configuration['person']);
 }
 /**
  * Data provider with Person models
  *
  * @return array Person models
  */
 public function dataPeople()
 {
     $r = array();
     $person = new PersonModel();
     $person->setRealName('Graham Christensen');
     $person->setGender(PersonModel::G_MALE);
     $r[] = array($person);
     $person = new PersonModel();
     $person->setRealName('Esley Svanas');
     $person->setGender(PersonModel::G_FEMALE);
     $r[] = array($person);
     $person = new PersonModel();
     $person->setRealName('Nina Arsenault');
     $person->setGender(PersonModel::G_OTHER);
     $r[] = array($person);
     return $r;
 }
예제 #4
0
 public static function getPerson($id)
 {
     $person = PersonModel::personPrepare()->where(PersonModel::getField('id'), $id)->first();
     if ($person->feed_id) {
         $person['posts'] = \Post::postsFeed($person->feed_id);
     } else {
         $person['posts'] = array();
     }
     return $person;
 }
 public function compile()
 {
     if ($this->personID > 0) {
         $objPerson = \PersonModel::findByPk($this->personID);
         $arrSize = deserialize($this->size);
         if ($objPerson) {
             $arrData = $this->getArrayOfPerson($objPerson, $arrSize);
             foreach ($arrData as $strName => $strValue) {
                 $this->Template->{$strName} = $strValue;
             }
             \Controller::addImageToTemplate($this->Template, $arrData);
         }
     }
 }
예제 #6
0
 /**
  * Generate the module
  */
 protected function compile()
 {
     $objPeople = \PersonModel::findBy('pid', $this->person_archiv, array('order' => 'sorting ASC'));
     $arrSize = deserialize($this->imgSize);
     if ($objPeople) {
         $strHTML = '';
         while ($objPeople->next()) {
             $objTemplate = new \FrontendTemplate($this->personTpl);
             $arrData = $this->getArrayOfPerson($objPeople, $arrSize);
             foreach ($arrData as $strName => $strValue) {
                 $objTemplate->{$strName} = $strValue;
             }
             \Controller::addImageToTemplate($objTemplate, $arrData);
             $strHTML .= $objTemplate->parse();
         }
     }
     $this->Template->strPeople = $strHTML;
 }
예제 #7
0
 public function email_notifications()
 {
     if (\WebAPL\Modules::checkInstance('person')) {
         $events = \CalendarModel::join(CalendarLangModel::getTableName(), \CalendarModel::getField('id'), '=', CalendarLangModel::getField('calendar_item_id'))->join(\CalendarGroup::getTableName(), \CalendarGroup::getField('id'), '=', \CalendarModel::getField('calendar_group_id'))->join(\CalendarPostModel::getTableName(), \CalendarPostModel::getField('calendar_group_id'), '=', \CalendarGroup::getField('id'))->where(CalendarLangModel::getField('lang_id'), \WebAPL\Language::getId())->where(\CalendarModel::getField('enabled'), 1)->where(\CalendarModel::getField('person_id'), '<>', 0)->select(CalendarLangModel::getField("*"), \CalendarModel::getField('event_date'), \CalendarModel::getField('repeat_frequency'), \CalendarModel::getField('repeat_to_date'), \CalendarModel::getField('person_id'), \CalendarModel::getField('post_id'), \CalendarModel::getField('period'))->orderBy(\CalendarModel::getField('event_date'), 'asc')->where(function ($query) {
             $query->where(function ($query) {
                 $query->where(DB::raw("DATE(" . CalendarModel::getField('event_date') . ")"), '=', DB::raw('DATE(CURRENT_TIMESTAMP)'));
             })->orWhere(function ($query) {
                 $query->where(\CalendarModel::getField('event_date'), '<=', DB::raw('CURRENT_TIMESTAMP'))->where(\CalendarModel::getField('repeat_to_date'), '>=', DB::raw('CURRENT_TIMESTAMP'))->where(\CalendarModel::getField('repeat_frequency'), '<>', 'none');
             });
         })->get();
         $event_list = \CalendarModel::generateEvents($events, false);
         $today_events = [];
         foreach ($event_list as $event) {
             if (date("Y-m-d", strtotime($event['event_date'])) === date("Y-m-d") && strtotime($event['event_date']) >= time()) {
                 echo " sendone ";
                 $today_events[] = $event;
                 $this->loadClass(['PersonModel'], 'person');
                 $person = \PersonModel::getPerson($event['person_id']);
                 if (isset($person->email) && $person->email) {
                     Template::viewModule($this->module_name, function () use($person, $event) {
                         \EmailModel::sendToAddress($person->email, "Do you have an event today", 'views.calendarEmail', ['person' => $person, 'event' => $event]);
                     });
                 }
             }
         }
     }
 }
예제 #8
0
 /**
  * load文件并给与权限判断
  */
 protected static function loadList($p_where = null, $p_order = null, $p_pageIndex = null, $p_pageSize = null, &$p_countThis = null, $isDetail = false)
 {
     $tmpResult = parent::loadList($p_where, $p_order, $p_pageIndex, $p_pageSize, $p_countThis, $isDetail);
     if (is_array($tmpResult) && array_key_exists('errorCode', $tmpResult)) {
         return $tmpResult;
     }
     switch ($auth = static::getAuthIfUserCanDoIt(Utility::getCurrentUserID(), $isDetail ? 'detail' : 'list', $tmpResult)) {
         case 'admin':
             //有管理权限
         //有管理权限
         case 'self':
             //作者
             break;
         case 'normal':
             //正常用户
         //正常用户
         case 'draft':
             //未激活
         //未激活
         case 'pending':
             //待审禁言
         //待审禁言
         case 'disabled':
             //封号
         //封号
         case 'visitor':
             //游客
             return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '您没有权限执行该操作');
             break;
         case 'empty':
             //空
             return Utility::getArrayForResults(RUNTIME_CODE_ERROR_DATA_EMPTY, '不存在对应数据');
             break;
         default:
             return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '您没有权限执行该操作');
             break;
     }
     PersonModel::$authViewDisabled = static::$authViewDisabledList[$auth];
     return $tmpResult;
 }
예제 #9
0
 public function vicemayor($data)
 {
     $item = Input::get('item');
     if ($item) {
         $person = \PersonModel::getPerson($item);
         if ($person) {
             $groups = [['persons' => [$person]]];
             $data["page"]->text = View::make(Person::$view_persons_secretar, array('groups' => $groups));
             return PageView::defaultView($data);
         }
     }
     $groups = PersonModel::getPostPersonGroups($data['page']->id);
     if ($groups) {
         $data["page"]->text = View::make(Person::$view_persons_big, array('groups' => $groups, 'page_url' => $data['page_url']));
     }
     return PageView::defaultView($data);
 }
$p1->addRelatives($a1);
$p1->addRelatives($a2);
$test->addResult(!$p1->findRelatives('Account')->contains($a1));
$test->addResult(!$a1->findRelatives('Person')->contains($p1));
$test->addResult($p1->findRelatives('Account')->contains($a2));
$test->addResult($a2->findRelatives('Person')->contains($p1));
$test->end();
/* ---------------------------------------------------------------------- M:M */
$test = $this->startTest('M:M, non-composite keys, non-recursive');
// Add relative from both sides
$p1 = PersonModel::create();
$b1 = Model::create('Book');
$p1->addRelatives($b1);
$test->addResult($p1->findRelatives('Book')->contains($b1));
$test->addResult($b1->findRelatives('Person')->contains($p1));
$p2 = PersonModel::create();
$b2 = Model::create('Book');
$b2->addRelatives($p2);
$test->addResult($p2->findRelatives('Book')->contains($b2));
$test->addResult($b2->findRelatives('Person')->contains($p2));
// Disown relative from both sides
$b2->disownRelatives($p2);
$test->addResult($p2->findRelatives('Book')->isEmpty());
$test->addResult($b2->findRelatives('Person')->isEmpty());
$p1->disownRelatives($b1);
$test->addResult($p1->findRelatives('Book')->isEmpty());
$test->addResult($b1->findRelatives('Person')->isEmpty());
// Add multiple relatives via a collection
$c = new ModelCollection(array($b1, $b2));
$p1->addRelatives($c);
$test->addResult($p1->findRelatives('Book')->contains($b1));
예제 #11
0
 public function sendmail()
 {
     $id = \Input::get('id');
     $html = \Input::get('messages');
     $person = \PersonModel::find($id);
     if ($person) {
         $data['html'] = $html;
         Template::viewModule($this->module_name, function () use($data, $person) {
             \Mail::send('views.email-mess', $data, function ($message) use($person) {
                 $message->from("noreply@{$_SERVER['SERVER_NAME']}", 'WebLPA');
                 $message->subject("Discutie on-line din " . date("Y-m-d H:i"));
                 $message->to($person->email);
             });
         });
     }
 }
 * Part of the PHPUnit Selenium2 PageObjects library
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright Marc Würth <*****@*****.**>
 * @link https://github.com/ravage84/phpunit-selenium2-pageobjects
 * @license http://www.opensource.org/licenses/mit-license.php MIT License
 * @package PHPUnit_Selenium2_PageObjects\Examples
 */
require_once __DIR__ . '/../PersonModel.php';
$name = isset($_POST['your_name']) ? $_POST['your_name'] : '';
$name = htmlspecialchars($name);
$gender = isset($_POST['gender']) ? $_POST['gender'] : '';
$p = new PersonModel();
$p->setRealName($name);
$p->setGender($gender);
?>
<!DOCTYPE html>
<head>
	<title>View your data</title>
</head>
<html>
<body>
<h1 id="title">Viewing your data</h1>
<table>
    <tr>
        <th>Your Name</th>
        <td id="output_your_name"><?php 
echo $p->getRealName();
예제 #13
0
 public function popup()
 {
     $session_id = \Session::get('chat_session_id');
     $data = array('persons' => PersonModel::join(PersonLangModel::getTableName(), PersonLangModel::getField('person_id'), '=', PersonModel::getField('id'))->select(PersonModel::getField('id'), PersonLangModel::getField('first_name'), PersonLangModel::getField('function'), PersonLangModel::getField('last_name'))->orderBy(PersonLangModel::getField('first_name'))->where(PersonModel::getField('for_audience'), 1)->where(PersonLangModel::getField('lang_id'), \WebAPL\Language::getId())->get(), 'session_exist' => false);
     if ($session_id) {
         $data['chat'] = \FireChatSession::find($session_id);
         if ($data['chat']) {
             if ($data['chat']->active) {
                 $data['session_exist'] = true;
                 $data['person'] = PersonModel::join(PersonLangModel::getTableName(), PersonLangModel::getField('person_id'), '=', PersonModel::getField('id'))->select(PersonModel::getField('id'), PersonLangModel::getField('first_name'), PersonLangModel::getField('function'), PersonLangModel::getField('last_name'))->orderBy(PersonLangModel::getField('first_name'))->where(PersonModel::getField('for_audience'), 1)->where(\PersonModel::getField('id'), $data['chat']->person_id)->where(PersonLangModel::getField('lang_id'), \WebAPL\Language::getId())->first();
                 $data['person_icon'] = \Files::getfile('person_chat', $data['chat']->person_id);
             }
         }
     }
     echo Template::moduleView($this->module_name, 'views.chat-popup', $data);
 }
<?php

require_once __DIR__ . '/../PersonModel.php';

$name = isset($_POST['your_name']) ? $_POST['your_name'] : '';
$name = htmlspecialchars($name);
$gender = isset($_POST['gender']) ? $_POST['gender'] : '';

$p = new PersonModel();
$p->setRealName($name);
$p->setGender($gender);

?>
<h1 id="title">Viewing your data</h1>
<table>
    <tr>
        <th>Your Name</th>
        <td id="output_your_name"><?php echo $p->getRealName(); ?>
    </tr>
    <tr>
        <th>Your Gender</th>
        <td id="output_your_gender"><?php echo $p->getGenderString(); ?>
    </tr>
</table>
예제 #15
0
파일: example.php 프로젝트: eyumay/ju.ejhs
<?php

include_once 'db.php';
$model = new PersonModel();
if (isset($submit)) {
    $model->setData($id, $name, $addr, $country, $status);
    switch ($action) {
        case 1:
            $model->update();
            break;
        default:
            $model->insert();
            break;
    }
    header("Location: {$PHP_SELF}?id={$model->id}&action=1");
}
include 'header.php';
echo '<p><font class=title>Person</font></p>';
if (isset($find)) {
    $result = $model->result($find);
    $view = new PersonView(&$model);
    $view->browse($result);
    die;
}
if (isset($id)) {
    $model->select($id);
}
$view = new PersonView(&$model);
if (!isset($action)) {
    $action = 0;
}
예제 #16
0
 public function deleteperson()
 {
     $id = Input::get('id');
     \PersonModel::where('id', $id)->delete();
     \PersonLangModel::where('person_id', $id)->delete();
     \Files::dropMultiple('person', $id);
     \Files::dropMultiple('person_chat', $id);
     \PersonRelModel::where('person_id', $id)->delete();
     return \Illuminate\Support\Facades\Redirect::to('person/list');
 }