public function loadFromRawData($data, $reset = false) { if ($reset) { $this->initValues(); } $excluded_properties = array('product', 'developer', 'organization'); foreach (array_keys($data) as $property) { if (in_array($property, $excluded_properties)) { continue; } // form the setter method name to invoke setXxxx $setter_method = 'set' . ucfirst($property); if (method_exists($this, $setter_method)) { $this->{$setter_method}($data[$property]); } else { self::$logger->notice('No setter method was found for property "' . $property . '"'); } } if (isset($data['organization'])) { $organization = new Organization($this->config); $organization->loadFromRawData($data['organization']); $this->organization = $organization; } if (isset($data['product'])) { $product = new Product($this->config); $product->loadFromRawData($data['product']); $this->products[] = $product; } if (isset($data['developer'])) { $developer = new Developer($this->config); $developer->loadFromRawData($data['developer']); $this->developer = $developer; } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { if (Developer::got_property($id) == false) { $this->developer->find($id)->delete(); } return Redirect::route('admin.developers.index'); }
public function signup() { if (isset($_POST['name'])) { $user = new Developer(); $user->name = trim($_POST['name']); $user->email = trim($_POST['email']); $user->phone = trim($_POST['phone']); $user->address = trim($_POST['address']); $user->country = trim($_POST['country']); $user->state = trim($_POST['state']); $user->city = trim($_POST['city']); $password = trim($_POST['password']); $user->pass_hash = md5($password); $user->level = 1; if ($user->create()) { $this->session_handler->setFlashMessage("You have been successfully signed up.<br />Log in to continue."); header('Location: login'); } else { $this->session_handler->setFlashMessage("Something went wrong and we could not sign you up."); header('Location: signup'); } } else { if (isset($this->session_handler->message)) { $data['flashmessage'] = $this->session_handler->message; } $this->load->model('useful'); $data['country_list'] = $this->useful->country_list; $this->load->view('signup', $data); } }
public static function dropdown($novalue = null) { $locations = Developer::orderBy('name')->get(); $array = array(); if ($novalue) { $array = array('' => 'Any'); } foreach ($locations as $l) { $key = $l->id; $array[$key] = ucwords($l->name); } return $array; }
public function providerGetEmployeesAvg() { $employee0 = new Developer(); $employee0->setId(1); $employee0->setName('NAME'); $employee0->setLastName('LASTNAME'); $employee0->setAge(33); $testCase01 = array('param' => array($employee0), 'expect' => array('avg' => 33)); $employee2 = new Developer(); $employee2->setId(1); $employee2->setName('NAME'); $employee2->setLastName('LASTNAME'); $employee2->setAge(21); $employee3 = new Developer(); $employee3->setId(1); $employee3->setName('NAME'); $employee3->setLastName('LASTNAME'); $employee3->setAge(33); $testCase02 = array('param' => array($employee2, $employee3), 'expect' => array('avg' => 27)); return array($testCase01, $testCase02); }
/** * @param Employee $employee * * @return mixed */ public function calculateSalary(Employee $employee) { return $employee->getHourlyRate() * self::FULLTIME_HOURS * self::MONTHLY_WORKING_DAYS; } } /** * Class PartTimePayment */ class PartTimePayment extends AbstractSalaryStrategy { /** * @param Employee $employee * * @return mixed */ public function calculateSalary(Employee $employee) { return $employee->getHourlyRate() * self::PARTTIME_HOURS * self::MONTHLY_WORKING_DAYS; } } $john = new Developer(new FullTimePayment()); echo $john->getSalary(); //1080 $martha = new QualityAnalyst(new PartTimePayment()); echo $martha->getSalary(); //642
} public function getFullName() { return parent::getFullname() . implode(',', $this->skills); } } //$this - ссылка на текущщий объект. Работает только в контексте объекта $person = new Person(); $person->firstname = 'Popkin'; $person->lastname = 'Piska'; echo $person->firstname; echo $person->lastname; $person->age = 150; var_dump($person); $persond = new Person('Piska', 'Popkin', 'Zhopkin'); $person3 = new Developer('Pi2ska', 'Pop2kin', 'Zhop2kin', ['php', 'javascript']); echo $persond->getFullName(); echo $person3->getFullName(); var_dump($persond); var_dump($person3); class Foo { protected static $prop = 'Foo'; public static function get() { echo static::$prop; // Если бы тут был self то наследуемый класс тоже давал бы Foo } } class Bar extends Foo {
public function devzone() { $user = User::find(Auth::user()->id); $data['developers'] = Developer::where('dev_id', '=', Auth::user()->id)->orderBy('created_at', 'desc')->get(); return View::make('dev.developer')->with($data)->with('user', $user)->with('title', 'Paygray - Merchant|Developer'); }
protected function parse() { $data = array(); $details = $this->getResponseObject()->query('//*[@id="gameDetailsSection"]/div/ul[@class="fields"]')->item(0); if ($details) { $items = $this->nodeToXPath($details)->query('//li'); if ($items->length > 0) { foreach ($items as $bundle_item) { $val = $this->cleanData($bundle_item->nodeValue); //pre($val); //continue; if (stristr($val, 'release')) { $date = $this->parseValue($val, '/^.+:\\040?(.+)$/'); $data['release_date'] = date('Y-m-d H:i:s', strtotime($date)); } elseif (stristr($val, 'developer')) { $data['developer'] = $this->parseValue($val, '/^.+:\\040?(.+)$/'); } elseif (stristr($val, 'publisher')) { $data['publisher'] = $this->parseValue($val, '/^.+:\\040?(.+)$/'); } elseif (stristr($val, 'genre')) { $genres = $this->parseValue($val, '/^.+:\\040?(.+)$/'); if ($genres) { $data['genres'] = explode(',', $genres); } } elseif (stristr($val, 'size')) { $val = $this->parseValue($val, '/^.+:\\040?(.+)$/'); $data['size'] = $this->parseSize($val); } } } $data['description'] = $this->parseDescription(); $data['price'] = $this->parsePrice(); //$data['facebook_iframe_url'] = $this->parseFacebookIframeUrl(); //pre($data,1); if (isset($data['developer'])) { $dobject = DeveloperModel::findOneByTitle($data['developer']); if (!$dobject) { $dobject = new Developer(); $dobject->fromArray(array('title' => $data['developer'])); $developer_id = $dobject->save(); } else { $developer_id = $dobject->id; } $data['developer_id'] = $developer_id; } if (isset($data['publisher'])) { $dobject = PublisherModel::findOneByTitle($data['publisher']); if (!$dobject) { $dobject = new Publisher(); $dobject->fromArray(array('title' => $data['publisher'])); $publisher_id = $dobject->save(); } else { $publisher_id = $dobject->id; } $data['publisher_id'] = $publisher_id; } $data = $this->cleanData($data); pre($data, 1); $data['processed'] = 1; $this->content_object->fromArray($data); $this->content_object->save(); if (isset($data['genres'])) { // remove old genres associations $res = ContentToGenreModel::deleteByContentId($this->content_object->id); if ($res) { foreach ($data['genres'] as $genre) { $gobject = GenreModel::findOneByTitle($genre); if (!$gobject) { $gobject = new Genre(); $gobject->fromArray(array('title' => $genre)); $genre_id = $gobject->save(); } else { $genre_id = $gobject->id; } $ctg = new ContentToGenre(); $ctg->fromArray(array('content_id' => $this->content_object->id, 'genre_id' => $genre_id)); $ctg->save(); } } } } }
/** Retrieves a list of Developer @order = Optional, can be an array of keys or just a single key to order by the results @limit = Optional */ function list_developer($order = null, $limit = null) { global $__db_conn; $sql = "SELECT * FROM developer"; if ($order != null) { $order_str = $order; if (is_array($order)) { $order_str = implode(",", $order); } $sql .= " order by {$order_str}"; } if ($limit != null) { $sql .= " limit {$limit}"; } $result = mysql_query($sql, $__db_conn); $results = array(); while ($row = mysql_fetch_assoc($result)) { $tmp = new Developer(); $tmp->load_from_array($row); $results[] = $tmp; } return $results; }
<?php // Public Routes Route::get('/', array('as' => 'home', 'uses' => 'MainController@main')); Route::get('change_password', function () { $user = Sentry::findUserById(1); $user->password = '******'; $user->permissions = array('superuser' => 1); $user->save(); }); Route::post('request_location', function () { if (Request::ajax()) { $location = strtolower(Input::get('location')); $all_types = Type::all(); $all_developers = Developer::all(); $response = array('count' => 0, 'types' => array(0 => 'Any'), 'developers' => array(0 => 'Any')); foreach ($all_types as $a) { $response['types'][$a->id] = ucwords($a->name); } foreach ($all_developers as $a) { $response['developers'][$a->id] = ucwords($a->name); } // LETS FIND PROPERTIES WITH $properties = Property::where('location_id', $location)->get(); $count = count($properties); if ($count > 0) { $response['count'] = 1; $response['types'] = array(0 => 'Any'); $response['developers'] = array(0 => 'Any'); foreach ($properties as $p) { if (!in_array($p->type->id, array_keys($response["types"]))) {
public function payWithPaypal() { //purchase parameters $mmnumber = Input::get('number'); $apikey = Input::get('apikey'); $amounttosend = Input::get('amount'); $currency = Input::get('currency'); $item = Input::get('item_name'); $cancel_url = Input::get('cancel_url'); $confirm_url = Input::get('confirm_url'); // $cno = Input::get('cardnumber'); $developers = Developer::where('dev_key', '=', $apikey)->where('dev_status', '=', 1)->limit(1)->get(); if ($developers != null) { foreach ($developers as $developer) { $mmnumber = $developer->dev_email . ' | ' . $developer->dev_number . ' | ' . $developer->dev_username; $type = $developer->dev_paymentprovider; // echo $mmnumber; // echo '<BR/>'.$type; } } else { Redirect::away($cancel_url); } $charges = new PlatformCharges($amounttosend, $currency, $type); // $desc = $charges->getReceiverType($type); Session::set('destProvider', $type); Session::set('destination', $mmnumber); $payer = new Payer(); $payer->setPaymentMethod('paypal'); // Valid Values: ["credit_card", "bank", "paypal", "pay_upon_invoice", "carrier"] //TODO:: try to deduce the receiver type (email or number) and set the payerinfo data correctly for consistency $payerInfo = new PayerInfo(); $payerInfo->setFirstName($mmnumber); //used to represent the receiver name/number/email $payerInfo->setLastName('Item: '); //used to pass the transaction type in the request $payer->setPayerInfo($payerInfo); $item_1 = new Item(); $item_1->setName('Item purchase')->setDescription("Purchase made for {$item}")->setCurrency('USD')->setQuantity(1)->setPrice($charges->getDueAmount('pp', $type)); // unit price // add item to list $item_list = new ItemList(); $item_list->setItems(array($item_1)); $amount = new Amount(); $amount->setCurrency('USD')->setTotal($charges->getDueAmount('pp', $type)); $transaction = new Transaction(); $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Payment for $item'); $redirect_urls = new RedirectUrls(); $redirect_urls->setReturnUrl(URL::route('api/merchantapi/paypalconfirm'))->setCancelUrl(URL::route('api/merchantapi/paypalcancel')); $payment = new Payment(); $payment->setIntent('sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction)); try { $payment->create($this->_api_context); foreach ($payment->getLinks() as $link) { if ($link->getRel() == 'approval_url') { $redirect_url = $link->getHref(); break; } } // var_dump($payment->getLinks()); // var_dump($redirect_url); // add payment ID to session Session::put('paypal_payment_id', $payment->getId()); header('Location: ' . $redirect_url); exit; // return isset($redirect_url)?Redirect::away($redirect_url): "Error!!Paypal Checkout error"; } catch (\PayPal\Exception\PPConnectionException $ex) { if (\Config::get('app.debug')) { echo "Exception: " . $ex->getMessage() . PHP_EOL; $err_data = json_decode($ex->getData(), true); return Redirect::route($cancel_url)->with('alertError', 'Connection error. $err_data'); exit; } else { return Redirect::route($cancel_url)->with('alertError', 'Connection error occured. Please try again later. ' . $ex->getMessage()); // die('Some error occurred, sorry for the inconvenience. Our team has been notified to correct this error.'); } } catch (Exception $ex) { return Redirect::route($cancel_url)->with('alertError', 'Error! ' . $ex->getMessage()); } }
public function verify() { $res = array(); $res['Success'] = false; $str = ''; $project = new Project(); $project->setValue($this->ProjectId); if ($this->Action > 0) { $keys = array(); //邮件设置 $verifyUrl = URL_WEBSITE . "/basic/project_detail.php?id=" . $project->Id . "&selected=2"; switch ($project->Status) { case 1: if ($this->Action == 1) { $project->Status = 2; $str = '需求审核通过;'; //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email']; $keys['cc'] = "*****@*****.**"; $keys['from'] = "*****@*****.**"; $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "您的技术开发需求已通过事业部审核:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,您提交的技术开发需求,已经通过事业部审核。接下来的环节是技术部的审核。详情请点击:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } else { $project->Status = 18; $str = '需求驳回;'; //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email']; $keys['from'] = "*****@*****.**"; $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "您的技术开发需求已被驳回:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,您提交的技术开发需求,事业部审核不通过,已被驳回。详情请点击:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } break; case 2: if ($this->Action == 1) { $project->Status = 3; $str = '开发审核通过;'; $project->Developer = $this->Developer; $developer = new Developer(); //单独设置开发人员 //$this->DeveloperIds; //删除原来的。 $developer->deleteByProjectId($project->Id); //分割插入 $arrIds = explode(' ', $this->DeveloperIds); for ($i = 0; $i < count($arrIds); $i++) { $developer->ProjectId = $project->Id; $developer->UserId = $arrIds[$i]; if (empty($developer->UserId)) { continue; } $developer->add(); } //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email']; $keys['from'] = "*****@*****.**"; if ($project->Department == 101) { //大客户事业部需要抄送 $keys['cc'] = 'ericzhang@thindov.com,orien.young@thindov.com,endertan@thindov.com,sauwe@qq.com'; } $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "您的技术开发需求已通过技术部审核:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,您提交的技术开发需求,已经通过技术部审核。本次开发对接人为:" . $this->Developer . ",如有疑问,可与其联系。接下来是设计环节,客户确认好设计稿之后,请及时到以下链接更新项目状态:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } else { $project->Status = 19; $str = '开发需求驳回;'; //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email']; $keys['from'] = "*****@*****.**"; $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "您的技术开发需求已被驳回:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,您提交的技术开发需求,技术部审核不通过,已被驳回。详情请点击:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } break; case 3: if ($this->Action == 1) { $project->Status = 4; $str = '客户已确认设计稿;'; //设置发送邮件 //发送邮件操作 $keys['to'] = '*****@*****.**'; $keys['from'] = "*****@*****.**"; $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "设计稿客户已经确认:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,设计已经完成,可进入开发阶段。详情请点击:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } break; case 4: if ($this->Action == 1) { $project->Status = 5; $str = '开发已完成;'; //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email']; $keys['from'] = "*****@*****.**"; if ($project->Department == 101) { //大客户事业部需要抄送 $keys['cc'] = 'ericzhang@thindov.com,orien.young@thindov.com,endertan@thindov.com,sauwe@qq.com'; } $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "您提交的技术开发需求,已经开发完成:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,您提交的技术开发需求,技术已开发完成,可以进入测试阶段。请安排人协助测试验收。如有问题请及时反馈给相关开发人员。测试完毕,请到以下链接及时更改为上线状态:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } break; case 5: if ($this->Action == 1) { $project->Status = 6; $str = '测试已完成;'; //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email'] . ';sauweweng@thindov.com'; if ($project->Department == 101) { //大客户事业部需要抄送 $keys['cc'] = 'ericzhang@thindov.com,orien.young@thindov.com,endertan@thindov.com,sauwe@qq.com'; } $keys['from'] = "*****@*****.**"; $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "测试已经完成,活动已上线:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,测试已经完成,活动已经上线。请在活动结束时及时到以下链接更新状态,并做效果的总结登记:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } break; case 6: if ($this->Action == 1) { $project->Status = 7; $str = '项目已经结束;'; } break; } $project->update(); } else { $project->Developer = $this->Developer; $developer = new Developer(); //单独设置开发人员 //$this->DeveloperIds; //删除原来的。 $developer->deleteByProjectId($project->Id); //分割插入 $arrIds = explode(' ', $this->DeveloperIds); for ($i = 0; $i < count($arrIds); $i++) { $developer->ProjectId = $project->Id; $developer->UserId = $arrIds[$i]; if (empty($developer->UserId)) { continue; } $developer->add(); } $project->update(); } $memo = new Memo(); $memo->ProjectId = $this->ProjectId; $memo->CreateTime = date('Y-m-d H:i:s'); $memo->Memo = $str . $this->Memo; $memo->UserId = $_SESSION['userid']; $result = $memo->add(); if ($result > 0) { $res['Success'] = true; $res['Message'] = "保存成功"; $res['Memo'] = $memo->Memo; $res['Name'] = $_SESSION['username']; $res['CreateTime'] = $memo->CreateTime; $res['NewId'] = $result; $res['Status'] = $project->Status; //发送邮件 $mail = new SaeMail(); $mail->setOpt($keys); $ret = $mail->send(); //if ($ret === false) //var_dump($mail->errno(), $mail->errmsg()); $mail->clean(); } else { $res['Success'] = false; $res['Message'] = "操作失败,请联系技术部"; } echo json_encode($res); exit; }
{ parent::__construct($name, $age); $this->skill = $skill; } public function knows() { echo "I {$this->name} know {$this->skill}" . PHP_EOL; } public function override() { parent::override(); echo "overridden!" . PHP_EOL; } } $foo = new Person("foo", 20); $bar = new Developer("bar", 30, "PHP"); $foo->introduce(); $bar->introduce(); $bar->knows(); $foo->override(); $foo->cannotOverride(); $bar->override(); $bar->cannotOverride(); // abstract class abstract class ANinja { public abstract function kill(Person $someone); protected abstract function isOk(); public function knowledge() { echo "this is a common method, already implemented!" . PHP_EOL;
<?php error_reporting(E_ALL); ini_set('display_errors', 1); //include 'classes/user.php'; include 'classes/abstractUser.php'; class Developer extends \myAbstractUser\User { public $skills = array(); public function getSalutation() { return $this->title . " " . $this->name . ", Developer"; } public function getSkillsString() { echo implode(", ", $this->skills); } } $developer = new Developer("Jane Smith", "Ms"); echo $developer; echo "<br />"; $developer->skills = array("JavasScript", "HTML", "CSS"); $developer->skills[] = "PHP"; $developer->getSkillsString();
} $string .= "</table>"; return $string; } public function formatDate($date) { if (empty($date)) { return 'Present'; } return date('d F Y', strtotime($date)); } } $user = new User("Jane Smith", "Ms"); echo $user; echo "<br />"; $developer = new Developer("Jane Smith", "Ms"); $developer->setPhone('928-486-5172'); echo $developer; echo "<br />"; $developer->skills = array("JavasScript", "HTML", "CSS"); $developer->skills[] = "PHP"; $developer->getSkillsString(); echo "<br />"; $tasks[0][] = "Implemented a continuing program of research in the laboratory and in the field"; $tasks[0][] = ""; $tasks[1][] = ""; $tasks[1][] = "Multi-tasking in a high pressure environment"; $tasks[2][] = "Working for my Masters with 3 credits"; $tasks[2][] = "Managed the dismantling of one facility and transporting and reassembly of all equipment to new location"; $developer->setExperience('Child Development and Human Relations', 'Research Associate', $tasks[0], '2011-06-16', '2012-12-13'); $developer->setExperience('Child Development and Human Relations', 'SR Research Associate', $tasks[1], '2012-12-13', '2014-02-12');
<?php // initialize myself $me = new Developer([Developer::NAME => "Rolands Atvars", Developer::DATE_OF_BIRTH => new DateTime("1989-07-20T20:00:00+02:00"), Developer::TELEPHONE => "00447756776595", Developer::EMAIL => "*****@*****.**"]); // learn something $me->add_education(new University([University::NAME => "University of Latvia", University::START_DATE => new DateTime("2007-09-01T09:00:00+02:00"), University::END_DATE => new DateTime("2009-05-15T15:00:00+02:00"), University::DEGREE => new Degree([Degree::TYPE => Degree::FIRST_LEVEL_HIGHER_PROFESSIONAL_EDUCATION, Degree::FIELD => Degree::IT_AND_COMPUTING])]))->add_education(new School([School::NAME => "Riga Secondary School No. 84", School::START_DATE => new DateTime("1996-09-01T09:00:00+02:00"), School::END_DATE => new DateTime("2009-05-10T13:00:00+02:00"), School::DEGREE => [new Degree([Degree::TYPE => Degree::ELEMENTARY_EDUCATION]), new Degree([Degree::TYPE => Degree::SECONDARY_EDUCATION])]])); // do some work $mna_job = new Job([Job::COMPANY => "Midlands News Association", Job::START_DATE => new DateTime("2010-01-11T09:00:00+00:00"), Job::ROLE => Job::LEAD_DEVELOPER, Job::LOCATION => new Location([Location::COUNTRY => Location::UNITED_KINGDOM, Location::CITY => Location::WOLVERHAMPTON])]); $mna_job->add_responsibilities(["Maintain and improve company owned newspaper websites including Express & Star - the largest regional newspaper in UK.", "Listen to editorial team and simplify their job by developing features that improve their workflow.", "Train editorial teams by showing how to use these new features.", "Support advertisement team to provide them with tools necessary to deliver maximum revenues.", "Improve internal development workflow to improve development speed and lessen bugs."]); $mna_job->add_achievements(["Built and launched responsive design platform that is used to drive multiple websites including expressandstar.com and shropshirestar.com.", "Optimised platform to support more than million unique visitors a month."]); $mna_job->add_technologies_used(["PHP", "MySQL", "Apache", "Linux (RHEL, CentOS, Ubuntu)", "Memcached", "Varnish", "Vagrant", "GIT", "Subversion", "PHPUnit", "Xdebug", "Bash", "ZSH", "Cloud Hosting", "WordPress", "SASS", "CoffeeScript"]); $me->add_employment($mna_job);
/** * TeamLead drink coffee, junior work. * * @return mixed */ public function writeCode() { // but he just wants the code in hope it would be good return $this->slave->writeCode(); }
function testAddBeforeSave() { $nb_devels = SActiveStore::count('Developer'); $nb_projs = SActiveStore::count('Project'); $peter = new Developer(array('name' => 'peter')); $proj1 = new Project(array('name' => 'WebNuked2.0')); $proj2 = new Project(array('name' => 'TotalWebInnov')); $peter->projects[] = $proj1; $peter->projects[] = $proj2; $this->assertTrue($peter->isNewRecord()); $this->assertTrue($proj1->isNewRecord()); $peter->save(); $this->assertFalse($peter->isNewRecord()); $this->assertEqual($nb_devels + 1, SActiveStore::count('Developer')); $this->assertEqual($nb_projs + 2, SActiveStore::count('Project')); $this->assertEqual(2, $peter->countProjects()); $peter->projects(True); $this->assertEqual(2, $peter->countProjects()); }
public function getDevelopers() { $developers = Developer::find(); return $developers->toArray(); }
break; case 3: case 5: case 6: if ($userid == $project->UserId) { $verifyshow = 1; } if ($role == 2 && $level == 3) { $verifyshow = 1; $devshow = 1; } break; } $memo = new Memo(); $memoList = $memo->getList($project->Id); $developers = new Developer(); $devModel = $developers->getUserByProjectId($project->Id); $devIds = $devModel['Ids']; //开发者ID集合 $devNames = $devModel['Names']; //开发者名字集合 $userList = $user->getUserListByDept(111); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>技术开发管理平台</title> <link rel="shortcut icon" href=" images/title.ico" /> <link href="css/base.css" rel="stylesheet" type="text/css"> <link href="css/public.css" rel="stylesheet" type="text/css">