function __construct($id, $name, $person, $telephone, $email, $address, $bal) { $this->person = $person; $type = new PartyType('Supplier'); $this->balance = new Money(floatval($bal), Currency::Get('KES')); parent::__construct($type, $id, $name, $telephone, $email, $address); }
/** * Execute the console command. * * @return mixed */ public function fire() { $this->info('Iniciando a requisição para o webservice'); $this->info('Carregando a lista de estados'); $estados = $this->makeRequest('estados'); $this->info('Foram encontrados ' . count($estados) . ' estados'); $this->info('Carregando a lista de cargos'); $cargos = CandidateType::all()->lists('id', 'type'); $this->info('Foram encontrados ' . count($cargos) . ' cargos'); $this->info('Carregando a lista de partidos'); $partidos = Party::all()->lists('id', 'abbreviation'); $this->info('Foram encontrados ' . count($partidos) . ' partidos'); foreach ($estados as $estado_id => $estado) { $this->info("Carregando os candidatos de {$estado->sigla} ({$estado_id}/" . count($estado) . ")"); foreach ($cargos as $cargo_nome => $cargo_id) { $this->info('- Procurando por ' . $cargo_nome); $candidatos = $this->makeRequest('candidatos', ['estado' => $estado->sigla, 'cargo' => $cargo_id]); foreach ($candidatos as $candidato) { $candidate = Candidate::where('full_name', $candidato->nome)->first(); if (!$candidate) { $this->info('-- Processando ' . $candidato->nome . '/' . $candidato->apelido); $picture_hash = Str::random(90) . ".jpg"; file_put_contents(app_path() . '/../www/uploads/' . $picture_hash, file_get_contents($candidato->foto)); Candidate::create(['party_id' => $partidos[$candidato->partido], 'candidate_type_id' => $cargos[ucfirst(strtolower(str_replace('º', '', (string) $candidato->cargo)))], 'nickname' => $candidato->apelido, 'full_name' => $candidato->nome, 'picture' => $picture_hash]); } } //$this->info('Foram encontrados ' . count($candidatos) . ' candidatos'); } } }
function __construct($id, $name, $telephone, $idno, $email, $address, $bal, $details) { $type = new PartyType('Client'); $this->idno = $idno; $this->balance = new Money(floatval($bal), Currency::Get('KES')); $this->details = $details; parent::__construct($type, $id, $name, $telephone, $email, $address); }
function __construct($id, $name, $telephone, $email, $address, $gender, $department, $position, $salary, $bal) { $type = new PartyType('Employee'); $this->balance = new Money(floatval($bal), Currency::Get('KES')); $this->salary = new Money(floatval($salary), Currency::Get('KES')); $this->gender = $gender; $this->department = $department; $this->position = $position; parent::__construct($type, $id, $name, $telephone, $email, $address); }
function loadParty($ID) { //check ID is not blank and exists and such $db = DB::GetConn(); $id_con = $db->quoteInto("ID = ?", $ID); $getQuery = "SELECT * FROM `Party` WHERE {$id_con} limit 1;"; $res = $db->query($getQuery); $obj = $res->fetchObject(); return Party::loadPartyFromObject($obj); }
/** * Execute the console command. * * @return mixed */ public function fire() { $this->info('Iniciando a requisição para o webservice'); $partidos = $this->makeRequest('partidos'); $this->info('Foram encontrados ' . count($partidos) . ' partidos.'); foreach ($partidos as $partido) { Party::create(['name' => $partido->sigla, 'abbreviation' => $partido->sigla]); } $this->info('Procedimento concluido com sucesso'); }
/** * Update the specified resource in storage. * PUT /api/partys * * @return Response */ public function update() { $data = Input::only('name', 'phone_number'); $party = Party::where('phone_number', $data['phone_number'])->first(); if ($party) { $party->name = $data['name']; $party->phone_number = $data['phone_number']; $party->save(); } else { $party = Party::create($data); } return Response::json($party); }
function __construct($tablename = 'company') { // Register non-persistent attributes // Construct the object parent::__construct($tablename); $this->idField = 'id'; // Set specific characteristics $this->subClass = true; $this->fkField = 'party_id'; $this->orderby = 'name'; $this->identifier = 'name'; $this->identifierField = 'name'; // Define validation $this->validateUniquenessOf('accountnumber'); $this->validateUniquenessOf('name'); // Define relationships $this->hasMany('PartyContactMethod', 'contactmethods', 'party_id', 'party_id'); $this->hasMany('PartyAddress', 'addresses', 'party_id', 'party_id'); $this->hasMany('PartyAddress', 'mainaddress', 'party_id', 'party_id'); $this->belongsTo('User', 'assigned', 'assigned_to'); $this->belongsTo('Company', 'parent_id', 'company_parent'); $this->belongsTo('CompanyClassification', 'classification_id', 'company_classification'); $this->belongsTo('CompanyIndustry', 'industry_id', 'company_industry'); $this->belongsTo('CompanyRating', 'rating_id', 'company_rating'); $this->belongsTo('CompanySource', 'source_id', 'company_source'); $this->belongsTo('CompanyStatus', 'status_id', 'company_status'); $this->belongsTo('CompanyType', 'type_id', 'company_type'); $this->addValidator(new DistinctValidator(array('id', 'parent_id'), 'Account cannot be it\'s own parent')); $this->actsAsTree('parent_id'); $this->setParent(); $this->hasOne('Party', 'party_id', 'party'); $this->hasMany('Person', 'people'); $this->hasMany('Opportunity', 'opportunities'); $this->hasMany('Project', 'projects'); $this->hasMany('Activity', 'activities'); $this->hasMany('CompanyInCategories', 'categories'); // Define field formats $this->getField('website')->setFormatter(new URLFormatter()); $this->getField('website')->type = 'html'; $system_prefs = SystemPreferences::instance(); $autoGenerate = $system_prefs->getPreferenceValue('auto-account-numbering', 'contacts'); if (!(empty($autoGenerate) && $autoGenerate === 'on')) { //$this->getField('accountnumber')->not_null=false; $this->_autohandlers['accountnumber'] = new AccountNumberHandler(); } else { $this->getField('accountnumber')->setnotnull(); } }
function __construct($tablename = 'person') { // Register non-persistent attributes // Contruct the object parent::__construct($tablename); // Set specific characteristics $this->idField = 'id'; $this->subClass = true; $this->fkField = 'party_id'; $this->orderby = array('surname', 'firstname'); $this->identifier = 'surname'; $this->identifierField = 'firstname || \' \' || surname'; $this->identifierFieldJoin = ', '; // Define relationships $this->hasMany('PartyContactMethod', 'contactmethods', 'party_id', 'party_id', null, TRUE); $this->hasMany('PartyAddress', 'addresses', 'party_id', 'party_id', null, TRUE); $this->hasMany('PartyAddress', 'mainaddress', 'party_id', 'party_id'); $this->belongsTo('Company', 'company_id', 'company'); $this->belongsTo('User', 'alteredby', 'last_altered_by'); $this->belongsTo('User', 'assigned_to', 'person_assigned_to'); $this->hasOne('Party', 'party_id', 'party'); $this->hasOne('Company', 'company_id', 'companydetail'); $this->actsAsTree('reports_to'); $this->belongsTo('Person', 'reports_to', 'person_reports_to', null, 'surname || \', \' || firstname'); $this->belongsTo('Language', 'lang', 'language'); $this->setConcatenation('fullname', array('title', 'firstname', 'middlename', 'surname', 'suffix')); $this->setConcatenation('titlename', array('title', 'firstname', 'surname')); $this->hasMany('Opportunity', 'opportunities'); $this->hasMany('Project', 'projects'); $this->hasMany('Activity', 'activities'); // Define field formats $this->getField('jobtitle')->tag = prettify('job_title'); // Define validation // Define default values // Define enumerated types }
/** * Get the full data set for a selected (single) user * * Gets the user, presenter, email, phone, address, and product credit records for this user. * Also returns the meta data - that is the available types for certain data types * for instance, the phones table has a type_id. * The meta data would contain the names of these types keyed to their id for referencing int he code. * Example: user.meta.phone[<insert the user's phone type id here>].name would dynamically give you the phone type name * * Returns stdClass * user * id * first_name * middle_name * last_name * entity * date_of_birth * consent_to_agreements * presenter * id * presenter_sequence_id * user_id * sponosr_id * market_id * market_sequence_id * government_id * consent_to_agreements * default_locale * terminated_date * presenter_status_id * _autiddate * status_level_name * status_level_id * presenter_site * id * presenter_id * site_url * is_primary * head_shot * bio * analytics_code * presenter_info * fast_start_end_date * email * {id} * id * email_type_id * user_id * email * phone * {id} * id * phone_type_id * user_id * nickname * phone * address * {id} * id * address_type_id * user_id * nickname * address1 * address2 * address3 * city * county * state_id * postal_code * country_id * product_credits * transactions * [] * product_credit_id * presenter_id * entry_user * amount * credit_type * entry_type * status * reference_id * timestamp * currency * balances * younique_cash * parties * [] * id * party_name * start_time * end_time * party_total * finalized_sate * display_result * presenter_sequence_id * presenter_facebook * hostess_facebook * presenter_name * hostess_name * display - initial display setting - closed parties are false, open are true * orders * [] * id * date_completed * presenter * customer * grand_total * status_name * status_id * display - initial display setting - closed parties are false, open are true * coupons * records * [] * id * coupon_presenter_id * user_id * date_added * user_visible * reference_id * date_redeemed * redemption_reference_id * redemption_amount * expiration_date * available * meta - see _getMeta for structure * * @param int $user_id * @param bool $include_meta_data * @return \stdClass */ public function getAllUserData($user_id, $include_meta_data = TRUE) { require_once APPLICATION_PATH . MODEL_DIR . '/User.php'; require_once APPLICATION_PATH . MODEL_DIR . '/Presenter.php'; require_once APPLICATION_PATH . MODEL_DIR . '/Email.php'; require_once APPLICATION_PATH . MODEL_DIR . '/Phone.php'; require_once APPLICATION_PATH . MODEL_DIR . '/Address.php'; require_once APPLICATION_PATH . MODEL_DIR . '/Address_geocode.php'; require_once APPLICATION_PATH . MODEL_DIR . '/Market.php'; require_once APPLICATION_PATH . MODEL_DIR . '/Product_credits.php'; require_once APPLICATION_PATH . MODEL_DIR . '/Order.php'; require_once APPLICATION_PATH . MODEL_DIR . '/Party.php'; require_once APPLICATION_PATH . MODEL_DIR . '/Coupon_presenter_user.php'; require_once APPLICATION_PATH . MODEL_DIR . '/User_oauth2.php'; require_once APPLICATION_PATH . MODEL_DIR . '/Accomplishments.php'; require_once APPLICATION_PATH . MODEL_DIR . '/Presenter_documents.php'; require_once APPLICATION_PATH . MODEL_DIR . '/Presenter_us_tax_data.php'; $results = new stdClass(); //user table $user = new User(); $results->user = $user->getDataById($user_id); //presenter $presenter = new Presenter(); $results->presenter = $presenter->getDataByUserId($user_id, TRUE); if (!empty($results->presenter)) { //compliance info $results->presenter->compliance = $presenter->getComplianceDataByUserId($user_id, $results->presenter->market_id); //presenter_site require_once APPLICATION_PATH . MODEL_DIR . '/Presenter_site.php'; $presenter_site = new Presenter_site(); $results->presenter_site = $presenter_site->getDataByPresenterId($results->presenter->id); //presenter_us_tax_data require_once APPLICATION_PATH . MODEL_DIR . '/Presenter_us_tax_data.php'; $results->presenter_us_tax_data = $presenter->getBusinessDataByPresenterId($results->presenter->id); //get presenter status require_once APPLICATION_PATH . MODEL_DIR . '/Presenter_type.php'; $presenter_type = new Presenter_type(); $results->presenter->status_level_id = $presenter_type->getMaxType($results->presenter->id); $results->presenter->status_level_name = $presenter_type->getPresenterStatusName($results->presenter->status_level_id); //get sponsor data $sponsor = new Presenter(); $results->presenter->sponsor = $sponsor->getSponsorData($results->presenter->sponsor_id); //presenter info $results->presenter_info = new stdClass(); $sign_up_date = new DateTime($results->presenter->consent_to_agreements); //to get the right end date for fast start, we ned to check if they are in a new market that had a 1 month //delay between sign up and sales $fast_start_end_date = YouniqueAPI::call("presenter/getFastStartDeadline/" . $results->presenter->presenter_sequence_id); $results->presenter_info->fast_start_end_date = date("M d, Y", strtotime($fast_start_end_date)); $presenter_documents = new Presenter_documents(); $results->presenter_documents = $presenter_documents->getPresenterDocuments($results->presenter->presenter_sequence_id); } //these have multiple records potentially, so we load them on their own //emails $email = new Email(); $results->email = $email->getDataByUserId($user_id); //phones $phone = new Phone(); $results->phone = $phone->getDataByUserId($user_id); //oauth $oauth = new User_oauth2(); $results->oauth = $oauth->getDataByUserId($user_id); //addresses $address = new Address(); $geo = new Address_geocode(); $results->address = $address->getDataByUserId($user_id); //accomplishments $accomplishments = new Accomplishments(); $results->accomplishments = $this->_sortAccomplishments($accomplishments->getDataByUserId($user_id)); foreach ($results->address as $a_key => &$a_value) { $a_geo = $geo->getByAddressId($a_value['id']); if (!$a_geo) { continue; } $a_value['geo_id'] = $a_geo->id; $a_value['lat'] = $a_geo->lat; $a_value['lng'] = $a_geo->lng; } //todo: apply geocodes //get product credit info $product_credits = new Product_credits(); $results->product_credits = new stdClass(); $results->product_credits->transactions = $product_credits->getTransactionsByUserId($user_id); $results->product_credits->balances = $product_credits->getBalancesByUserId($user_id); //markets $market = new Market(); $results->country_codes = new stdClass(); $results->country_codes->transactions = $market->getCountryCodesByMarkets(); $result = new stdClass(); foreach ($results as $key => $value) { if ($key == 'accomplishments') { $result->{$key} = $value; continue; } $result->{$key} = $this->_rekeyArray($value); } //orders $order = new Order(); $result->orders = $order->getOrdersByUserId($user_id); //check replacement percentage $order_ids = []; foreach ($result->orders as $value) { $order_ids[] = $value['id']; } if (!empty($results->presenter)) { $result->presenter->replacement_percentage = $order->getUserReplacementOrderPercentage($order_ids); //parties $party = new Party(); $result->parties = $party->getPresenterParties($results->presenter->id); } //coupons $coupon = new Coupon_presenter_user(); $result->coupons = new stdClass(); $result->coupons->records = $coupon->getDataByUserId($user_id); $result->coupons->promocoupons = $coupon->getPromoCoupons(); $result->coupons->promorecords = $coupon->getPromoDataByUserId($user_id); $result->coupons->available = 0; $result->coupons->promoavailable = 0; if (!empty($result->coupons->promorecords)) { foreach ($result->coupons->promorecords as $key => $value) { if ($value['date_redeemed'] == NULL) { $result->coupons->promoavailable++; } } } foreach ($result->coupons->records as $key => $value) { if ($value['date_redeemed'] == NULL) { $result->coupons->available++; } } //meta if ($include_meta_data) { $result->meta = $this->_getMetaData(); } return $this->_filterResults($result); }
} } } /** * Handler for the change presenter functionality */ if (isset($_POST['form']) && $_POST['form'] == "change_presenter") { if (isset($_POST['presenter_sequence_id']) && isset($_POST['party_id'])) { //get the presenter id from the sequence id require_once APPLICATION_PATH . MODEL_DIR . '/Presenter.php'; $presenter = new Presenter(); $presenter_id = $presenter->getIdBySequenceId($_POST['presenter_sequence_id']); if ($presenter_id) { $data = array("id" => $_POST['party_id'], "presenter_id" => $presenter_id); require_once APPLICATION_PATH . MODEL_DIR . '/Party.php'; $party = new Party(); $party->set($data); if ($party->save()) { $result->success = TRUE; $result->message = "Presenter changed successfully."; } else { $result->success = FALSE; $result->message = "Failed to change presenter."; } } else { $result->success = FALSE; $result->message = "Failed to change presenter. Check the presenter id."; } } } header('Content-Type: application/json');
$result = ""; $filters = $_POST['filters']; require_once APPLICATION_PATH . MODEL_DIR . '/Party.php'; $party = new Party(); $result = $party->search($search_term, $filters, $search_type); } } /** * Once a search result has been selected, this gets the rest of the selected user's info */ if (isset($_POST['form']) && $_POST['form'] == "get_party_info") { if (isset($_POST['party_id'])) { require_once APPLICATION_PATH . MODEL_DIR . '/Party.php'; require_once APPLICATION_PATH . MODEL_DIR . '/Ajax.php'; $party_id = $_POST['party_id']; $result = ""; $party = new Party(); $result = $party->preparePartyRecord($party_id); $ajax = new Ajax(); $search_name = $result->party->name; $search_id = $result->party->id; $result->search_history = $ajax->storeSearchResult('party_search_history', $search_id, $search_name); } } if (isset($_POST['form']) && $_POST['form'] == "get_search_history") { require_once APPLICATION_PATH . MODEL_DIR . '/Ajax.php'; $ajax = new Ajax(); $result = $ajax->getSearchHistory($_POST['search_type']); } header('Content-Type: application/json'); echo json_encode(array("result" => $result));
<?php // If you are accessing this page directly, redirect to the front page if (!$DB_USER) { header('Location: http://www.hartapoliticii.ro'); } include 'hp-includes/party_class.php'; // -------------------------- Initialization stuff -------------------- $id = $_GET['id'] ? (int) $_GET['id'] : 0; if ($id == 0) { return; } $party = new Party($id); // --------------------------- Display Header --------------------- $title = $party->longName; include 'header.php'; // ---------------------------- Display Breadcrumbs --------------- $t = new Smarty(); $t->assign('name', $party->longName); $crumbs = array(); $crumbs[] = array('name' => 'Sumar', 'href' => '?cid={$cid}&id={$party->id}'); $t->assign('crumbs', $crumbs); $t->display('person_top_bar.tpl'); // ----------------------------- Left sidebar----------- ---------- echo '<table width=970><td valign=top width=340>'; $t = new Smarty(); $t->assign('logo', $party->getLogo()); list($width, $height, $type, $attr) = getimagesize($party->getLogo()); $t->assign('logo_width', min(250, $width)); $t->display('party_left_sidebar.tpl'); // ----------------------------- Display Actual Content ----------
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Party::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
function delParty($id) { $tobeDeleted = new Party($id); if ($tobeDeleted->isNew()) { return true; } // item never existed in the first place if ($tobeDeleted->del()) { return true; } else { return $tobeDeleted; } }
$cases[$i0] = array('id' => @$r['0.' . $i0 . '.0'], 'nr' => @$r['0.' . $i0 . '.0'], 'area of law' => @$r['0.' . $i0 . '.1']); $cases[$i0]['type of case'] = array(); for ($i1 = 0; isset($r['0.' . $i0 . '.2.' . $i1]); $i1++) { $cases[$i0]['type of case'][$i1] = @$r['0.' . $i0 . '.2.' . $i1 . '']; } } $role = @$r['1']; $authorized = array(); for ($i0 = 0; isset($r['2.' . $i0]); $i0++) { $authorized[$i0] = array('id' => @$r['2.' . $i0 . '']); $authorized[$i0]['representative'] = array(); for ($i1 = 0; isset($r['2.' . $i0 . '.0.' . $i1]); $i1++) { $authorized[$i0]['representative'][$i1] = @$r['2.' . $i0 . '.0.' . $i1 . '']; } } $Party = new Party($ID, $cases, $role, $authorized); if ($Party->save() !== false) { die('ok:' . $_SERVER['PHP_SELF'] . '?Party=' . urlencode($Party->getId())); } else { die(''); } exit; // do not show the interface } $buttons = ""; if (isset($_REQUEST['new'])) { $new = true; } else { $new = false; } if (isset($_REQUEST['edit']) || $new) {
<?php require_once dirname(__FILE__) . '/../facebook.php'; require_once dirname(__FILE__) . "/../model/President.php"; require_once dirname(__FILE__) . "/../model/Follower.php"; require_once dirname(__FILE__) . "/../model/Party.php"; require_once dirname(__FILE__) . "/../model/Princess.php"; require_once dirname(__FILE__) . '/../calc_used_money.php'; // 下準備なう $President = new President(); $Follower = new Follower(); $Party = new Party(); $Princess = new Princess(); // facebook_idの取得 $facebook_id = $facebook->getUser(); // President情報の取得 $presidents = $President->findBy(array('facebook_id' => $facebook_id)); if ($presidents->num_rows == 0) { echo 'president取得の失敗なう'; die; } $president = $presidents->fetch_assoc(); // Presidentに紐付くParty情報の取得 $party = array(); $result = $Party->findBy(array('president_id' => $facebook_id)); while ($row = $result->fetch_assoc()) { array_push($party, $row); } // Presidentに紐付くPartyに紐付くFollowers情報の取得 $followers = array(); foreach ($party as $party_member) {
public static function canCreate(Party $parent, Party $child, AccountabilityType $accountabilityType) { if ($parent == $child) { return false; } elseif ($parent->ancestorsInclude($child, $accountabilityType)) { return false; } else { return $accountabilityType->canCreateAccountability($parent, $child); } }
function __construct($id, $name, $telephone, $email, $address, $city, $country, $website, $contactId) { $type = new PartyType('Vendor'); parent::__construct($type, $id, $name, $telephone, $email, $address, $city, $country); $this->website = $website; //$this->contactPerson = Party::Get($contactId);//PartyType('Account Manager'); }
function __construct($id, $name, $telephone, $email, $address, $shipaddress) { $type = new PartyType('Customer'); parent::__construct($type, $name, $telephone, $email, $address); $this->shippingaddress = $shipaddress; }
<?php /** * Followerリストを表示する画面 */ require_once dirname(__FILE__) . '/../facebook.php'; require_once dirname(__FILE__) . '/../model/Follower.php'; require_once dirname(__FILE__) . '/../model/Party.php'; require_once dirname(__FILE__) . '/../calc_used_money.php'; // Follower,Party Model用意 $Follower = new Follower(); $Party = new Party(); // 全Follower情報取得を試みる $fql = 'SELECT uid,name,pic,sex FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())'; $followers = $facebook->api(array('method' => 'fql.query', 'query' => $fql)); $followers_data = array(); // 全Followerの情報がMySQLにあるか確認 なければINSERT foreach ($followers as $follower) { $uid = $follower['uid']; $result = $Follower->findBy(array('facebook_id' => $uid)); if ($result->num_rows == 0) { // INSERTするデータを用意 $data = array('facebook_id' => $uid, 'name' => $follower['name'], 'power' => Job::getPower($uid), 'money' => Job::getMoney($uid), 'pic' => $follower['pic'], 'sex' => $follower['sex'] == 'male' ? 0 : 1, 'job_name' => Job::getMood($uid) . Job::getPosition($uid) . Job::getJob($uid)); $Follower->insert($data); array_push($followers_data, $data); } else { $follower_info = $result->fetch_assoc(); array_push($followers_data, $follower_info); } } $party = array('', '', '');
<?php /** * Followerを最大3名受け取ってカードデッキに格納する */ require_once dirname(__FILE__) . '/../facebook.php'; require_once dirname(__FILE__) . '/../model/Party.php'; // Party Model用意 $Party = new Party(); $president_id = $facebook->getUser(); // follower_ids = Facebook ID $follower_ids = array(); array_push($follower_ids, $_POST['follower_id1']); array_push($follower_ids, $_POST['follower_id2']); array_push($follower_ids, $_POST['follower_id3']); if (count($follower_ids) > 0) { $Party->remove(array('president_id' => $president_id)); foreach ($follower_ids as $follower_id) { $data = array('president_id' => $president_id, 'follower_id' => $follower_id); $Party->insert($data); } } header("HTTP/1.1 301 Moved Permanently"); header("Location: /president/index.php");
/** * Return the wait time for a visist */ public function waittime($number) { $party = Party::with('visits')->where('phone_number', $number)->first(); $mostRecentVisit = $party->visits->first(); return Response::json($mostRecentVisit->waitTime()); }