本文整理汇总了PHP中Organization类的典型用法代码示例。如果您正苦于以下问题:PHP Organization类的具体用法?PHP Organization怎么用?PHP Organization使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Organization类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadFromRawData
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;
}
}
示例2: signup
/**
* Signup a new account with the given parameters
*
* @param array $input Array containing 'username', 'email' and 'password'.
*
* @return User User object that may or may not be saved successfully. Check the id to make sure.
*/
public function signup($input)
{
// $name = array_get($input, 'organization');
$org = new Organization();
$lcode = $org->encode($name);
$organization = Organization::find(array_get($input, 'organization_id'));
$organization->licensed = 100;
$organization->license_code = $lcode;
$organization->update();
$user = new User();
$user->username = array_get($input, 'username');
$user->email = array_get($input, 'email');
$user->password = array_get($input, 'password');
$user->user_type = array_get($input, 'user_type');
$user->username = array_get($input, 'username');
$user->organization_id = '1';
// The password confirmation will be removed from model
// before saving. This field will be used in Ardent's
// auto validation.
$user->password_confirmation = array_get($input, 'password_confirmation');
// Generate a random confirmation code
$user->confirmation_code = md5(uniqid(mt_rand(), true));
// Save if valid. Password field will be hashed before save
$this->save($user);
return $user;
}
示例3: doApprove
public function doApprove()
{
$exist = Member::get()->filter(array('Email' => $this->Email))->first();
if ($exist) {
return false;
}
$member = new Member();
$data = $this->toMap();
unset($data['ID']);
unset($data['ClassName']);
unset($data['UnapprovedMember']);
$member->update($data);
$member->write();
if ($this->MemberType === 'Organization') {
$member->addToGroupByCode('organization');
$organization = new Organization();
$organization->AccountID = $member->ID;
$organization->company_name = $this->OrganizationName;
$organizationID = $organization->write();
$member->OrganizationID = $organizationID;
$member->write();
} else {
$member->addToGroupByCode('personal');
}
$this->setField('Approved', true);
$this->write();
return true;
}
示例4: setUp
/**
* set up for dependent objects before running each test
*/
public final function setUp()
{
//run default set-up method
parent::setUp();
//create a new organization for the test volunteers to belong
$organization = new Organization(null, "123 Easy Street", '', "Albuquerque", "Feeding people since 1987", "9 - 5", "Food for Hungry People", "505-765-4321", "NM", "R", "87801");
$organization->insert($this->getPDO());
//create a new volunteer to use as an admin for the tests
//don't need to insert them into the database: just need their info to create sessions
//for testing purposes, allow them to create organizations they're not associated with
$salt = bin2hex(openssl_random_pseudo_bytes(32));
$hash = hash_pbkdf2("sha512", "password4321", $salt, 262144, 128);
$this->admin = new Volunteer(null, $organization->getOrgId(), "fakeemail@fake.com", null, "John", $hash, true, "Doe", "505-123-4567", $salt);
$this->admin->insert($this->getPDO());
//create a non-admin volunteer for the tests
$salt = bin2hex(openssl_random_pseudo_bytes(32));
$hash = hash_pbkdf2("sha512", "password1234", $salt, 262144, 128);
$this->volunteer = new Volunteer(null, $organization->getOrgId(), "notanemail@fake.com", null, "Jane", $hash, false, "Doe", "505-555-5555", $salt);
$this->volunteer->insert($this->getPDO());
//create the guzzle client
$this->guzzle = new \GuzzleHttp\Client(["cookies" => true]);
//visit ourselves to get the xsrf-token
$this->guzzle->get('https://bootcamp-coders.cnm.edu/~tfenstermaker/bread-basket/public_html/php/api/organization');
$cookies = $this->guzzle->getConfig()["cookies"];
$this->token = $cookies->getCookieByName("XSRF-TOKEN")->getValue();
//send a request to the sign-in method
$adminLogin = new stdClass();
$adminLogin->email = "fakeemail@fake.com";
$adminLogin->password = "password4321";
$login = $this->guzzle->post('https://bootcamp-coders.cnm.edu/~tfenstermaker/bread-basket/public_html/php/controllers/sign-in-controller.php', ['json' => $adminLogin, 'headers' => ['X-XSRF-TOKEN' => $this->token]]);
}
示例5: create
function create()
{
$organization = new Organization();
$organization->name = $_POST['name'];
if ($organization->save()) {
$this->redirect('/organizations', 'Criado com sucesso!');
} else {
$this->redirect('/organizations', 'Falha na criação!');
}
}
示例6: run
public function run()
{
$organization = new Organization();
$organization->name = 'Helpster';
$organization->date_established = '2015-02-24';
$organization->description = 'Helpster is a site dedicated to link volunteer organizations to prospecting volunteers';
$organization->website = 'http://helpster.site';
$organization->image = 'helpster.png';
$organization->user_id = 4;
$organization->save();
}
示例7: findOrCreateOrganization
public function findOrCreateOrganization()
{
$organization = $this->owner->Organization();
if ($organization->ID) {
return $organization;
}
$organization = new Organization();
$organization->write();
$organization->Members()->add($this->owner);
return $organization;
}
示例8: update
public function update(Organization $org)
{
$name = trim(Input::get('name'));
$redirect = Redirect::route('settings', $org->slug);
if ($name) {
$org->name = $name;
$org->css = Input::get('css', []);
$org->save();
return $redirect->withSuccess('Organization updated successfully');
} else {
return $redirect->withError('Name may not be blank');
}
}
示例9: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$organization = Organization::find($id);
$organization->delete();
Session::flash('successMessage', 'Your delete was successful.');
return Redirect::action('OrganizationsController@index');
}
示例10: postGeneral
public function postGeneral($id)
{
$id = Crypt::decrypt($id);
$request = RRequest::find($id);
if (Input::has('save')) {
if (Input::get('employee') == 0 || Input::get('organization') == 0 || Input::get('r_plan') == 0 || Input::get('specialist') == 0 || strlen(Input::get('title')) < 2 || strlen(Input::get('description')) < 2) {
Session::flash('sms_warn', trans('sta.require_field'));
} else {
$request->request_by_id = Input::get('employee');
$request->for_organization_id = Input::get('organization');
$request->for_planning_id = Input::get('r_plan');
$request->to_department_id = Input::get('specialist');
$request->request_title = Input::get('title');
$request->description = Input::get('description');
$request->request_date = date('Y-m-d');
$request->created_by = Auth::user()->employee_id;
if ($request->save()) {
Session::flash('sms_success', trans('sta.save_data_success'));
//return Redirect::to('branch_request/general/' . Crypt::encrypt($request->id));
}
}
}
$organizations = $this->array_list(Organization::list_item());
$employees = $this->array_list(Employee::list_item());
$department = $this->array_list(Department::list_item());
$r_plans = $this->array_list(Rplan::list_item());
return View::make('branch_request.edit_general', array('id' => $id, 'organizations' => $organizations, 'employees' => $employees, 'specialist' => $department, 'r_plans' => $r_plans, 'request' => $request));
}
示例11: getOrgDocs
public function getOrgDocs($id)
{
$organization = Organization::find($id);
$user = Organization::find($id)->user();
$documents = User::find($organization->user->id)->documents;
return View::make('inspector.documents_view', ['organization' => $organization, 'user' => $user, 'documents' => $documents]);
}
示例12: stock
public function stock()
{
$items = Item::all();
$organization = Organization::find(1);
$pdf = PDF::loadView('erpreports.stockReport', compact('items', 'organization'))->setPaper('a4')->setOrientation('potrait');
return $pdf->stream('Stock Report.pdf');
}
示例13: balanceSheet
public static function balanceSheet($date)
{
$accounts = Account::all();
$organization = Organization::find(1);
$pdf = PDF::loadView('pdf.financials.balancesheet', compact('accounts', 'date', 'organization'))->setPaper('a4')->setOrientation('potrait');
return $pdf->stream('Balance Sheet.pdf');
}
示例14: run
public function run()
{
$events = array();
$organization = Organization::getPublicData($id);
if (isset($organization["links"]["events"])) {
foreach ($organization["links"]["events"] as $key => $value) {
$event = Event::getPublicData($key);
$events[$key] = $event;
}
}
foreach ($organization["links"]["members"] as $newId => $e) {
if ($e["type"] == Organization::COLLECTION) {
$member = Organization::getPublicData($newId);
} else {
$member = Person::getPublicData($newId);
}
if (isset($member["links"]["events"])) {
foreach ($member["links"]["events"] as $key => $value) {
$event = Event::getPublicData($key);
$events[$key] = $event;
}
}
}
Rest::json($events);
}
示例15: run
/**
* Update an information field for an organization
*/
public function run()
{
$organizationId = "";
$res = array("result" => false, "msg" => Yii::t("common", "Something went wrong!"));
if (!empty($_POST["pk"])) {
$organizationId = $_POST["pk"];
} else {
if (!empty($_POST["id"])) {
$organizationId = $_POST["id"];
}
}
if ($organizationId != "") {
if (!empty($_POST["name"]) && !empty($_POST["value"])) {
$organizationFieldName = $_POST["name"];
$organizationFieldValue = $_POST["value"];
try {
Organization::updateOrganizationField($organizationId, $organizationFieldName, $organizationFieldValue, Yii::app()->session["userId"]);
$res = array("result" => true, "msg" => Yii::t("organisation", "The organization has been updated"), $organizationFieldName => $organizationFieldValue);
} catch (CTKException $e) {
$res = array("result" => false, "msg" => $e->getMessage(), $organizationFieldName => $organizationFieldValue);
}
}
}
Rest::json($res);
}