public function testGetMe() { $at = getenv("BB_ACCESS_TOKEN"); $o = Organization::get($at); $this->assertInstanceOf('\\ClausConrad\\BillysBilling\\Organization', $o, 'Getting own organization returns an Organization instance.'); $this->assertNotNull($o->id, 'Own organization has an organization ID.'); $this->assertNotEmpty($o->id, 'Own organization has an organization ID'); }
public function PersonalRegisterForm() { $fields = FieldList::create(array(EmailField::create('Email', '电子邮件'), ConfirmedPasswordField::create('Password', '密码'), TextField::create('FullName', '姓名'), TextField::create('IDCard', '身份证号码'), TextField::create('Phone', '联系电话'), DropdownField::create('OrganizationID', '所属单位名称', Organization::get()->map('ID', 'company_name'))->setEmptyString('请选择'))); $actions = FieldList::create(array(FormAction::create('doRegisterPersonal', '提交'))); $required = RequiredFields::create(array('Email', 'Password', 'FullName', 'IDCard', 'Phone', 'OrganizationID')); $form = new Form($this, __FUNCTION__, $fields, $actions, $required); return $form; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $rsvps = Rsvp::where('user_id', '=', Auth::user()->id)->get(); $organizations = Organization::get(); $user = Auth::user(); if (empty($user->first_name) || empty($user->last_name) || empty($user->zip)) { return Redirect::action('UsersController@edit', [$user->id]); } return View::make('users.index')->with('rsvps', $rsvps); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $organizations = Organization::get(); return View::make('admin')->with('organizations', $organizations); }
public function load_organizations() { $country_id = $_POST['country_id']; $data = new Organization(); if ($country_id > 0) { $data->where('country_id', $country_id); } $data->get(); echo '<select name="org_id" class="form-control">'; echo '<option value="">-- select organization --</option>'; foreach ($data as $key => $data_item) { echo '<option value="' . $data_item->id . '">' . $data_item->org_name . '</option>'; } echo '</select>'; }
// Record Organization and create similar // Insert new organization...: $edited_Organization = new Organization(); // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('organization'); // Check permission: $current_User->check_perm('users', 'edit', true); // load data from request if ($edited_Organization->load_from_Request()) { // We could load data from form without errors: // While inserting into DB, ID property of Organization object will be set to autogenerated ID // So far as we set ID manualy, we need to preserve this value // When assignment of wrong value will be fixed, we can skip this $entered_organization_id = $edited_Organization->ID; $DB->begin(); $duplicated_organization_ID = $edited_Organization->dbexists('org_name', $edited_Organization->get('name')); if ($duplicated_organization_ID) { // We have a duplicate entry: param_error('org_name', sprintf(T_('This organization name already exists. Do you want to <a %s>edit the existing organization</a>?'), 'href="?ctrl=organizations&action=edit&org_ID=' . $duplicated_organization_ID . '"')); } else { // Insert in DB: $edited_Organization->dbinsert(); $Messages->add(T_('New organization created.'), 'success'); } $DB->commit(); if (!param_errors_detected()) { // No errors switch ($action) { // What next? case 'create_copy': // Redirect so that a reload doesn't write to the DB twice:
public function all() { $organizations = Organization::get(); return View::make('organization.organizations')->with('organizations', $organizations); }