Gets the form used for agreeing or disagreeing to the ip agreement
@param {int} $id ID of the record to fetch
@param {FieldList} $fields Fields to use
@return {Form} Form to be used
976966
public function getEditForm($id=null, $fields=null) {
        $defaultPanel=Config::inst()->get('AdminRootController', 'default_panel');
        if($defaultPanel=='CodeBank') {
            $defaultPanel='SecurityAdmin';
            $sng=singleton($defaultPanel);
        }
        
        
        $fields=new FieldList(
                            new TabSet('Root',
                                            new Tab('Main',
                                                        new HeaderField('IPMessageTitle', _t('CodeBank.IP_MESSAGE_TITLE', '_You must agree to the following terms before using Code Bank'), 2),
                                                        new LiteralField('IPMessage', '<div class="ipMessage"><div class="middleColumn">'.CodeBankConfig::CurrentConfig()->dbObject('IPMessage')->forTemplate().'</div></div>'),
                                                        new HiddenField('RedirectLink', 'RedirectLink', $sng->Link())
                                                    )
                                        )
                        );
        
        
        if(Session::get('CodeBankIPAgreed')===true) {
            $fields->addFieldToTab('Root.Main', new HiddenField('AgreementAgreed', 'AgreementAgreed', Session::get('CodeBankIPAgreed')));
        }
        
        
        $actions=new FieldList(
                                FormAction::create('doDisagree', _t('CodeBankIPAgreement.DISAGREE', '_Disagree'))->addExtraClass('ss-ui-action-destructive'),
                                FormAction::create('doAgree', _t('CodeBankIPAgreement.AGREE', '_Agree'))->addExtraClass('ss-ui-action-constructive')
                            );
        
        $form=CMSForm::create($this, 'EditForm', $fields, $actions)->setHTMLID('Form_EditForm');
        $form->disableDefaultAction();
        $form->addExtraClass('cms-edit-form');
        $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
        $form->addExtraClass('center '.$this->BaseCSSClasses());
        $form->setAttribute('data-pjax-fragment', 'CurrentForm');
        
        
        //Display message telling user to run dev/build because the version numbers are out of sync
        if(CB_VERSION!='@@VERSION@@' && CodeBankConfig::CurrentConfig()->Version!=CB_VERSION.' '.CB_BUILD_DATE) {
            $form->setMessage(_t('CodeBank.UPDATE_NEEDED', '_A database upgrade is required please run {startlink}dev/build{endlink}.', array('startlink'=>'<a href="dev/build?flush=all">', 'endlink'=>'</a>')), 'error');
        }else if($this->hasOldTables()) {
            $form->setMessage(_t('CodeBank.MIGRATION_AVAILABLE', '_It appears you are upgrading from Code Bank 2.2.x, your old data can be migrated {startlink}click here to begin{endlink}, though it is recommended you backup your database first.', array('startlink'=>'<a href="dev/tasks/CodeBankLegacyMigrate">', 'endlink'=>'</a>')), 'warning');
        }
        
        
        
        $form->Actions()->push(new LiteralField('CodeBankVersion', '<p class="codeBankVersion">Code Bank: '.$this->getVersion().'</p>'));
        
        Requirements::javascript(CB_DIR.'/javascript/CodeBank.IPMessage.js');
        
        return $form;
    }
114368
public function getEditForm($id = null, $fields = null)
    {
        $form = parent::getEditForm($id, $fields);
        $siteConfig = SiteConfig::current_site_config();
        /**
         * SortOrder is ignored unless sortable is enabled.
         */
        if ($this->modelClass === "Tag" && $siteConfig->AllowTags) {
            $form->Fields()
                ->fieldByName('Tag')
                ->getConfig()
                ->addComponent(
                    new GridFieldOrderableRows(
                        'SortOrder'
                    )
                );
        }
        if ($this->modelClass === "News" && !$siteConfig->AllowExport) {
            $form->Fields()
                ->fieldByName("News")
                ->getConfig()
                ->removeComponentsByType('GridFieldExportButton')
                ->addComponent(
                    new GridfieldNewsPublishAction()
                );
        }

        return $form;
    }
413748
public function update($id, $fields)
    {
        $fields = $this->makeJsonReady($fields);
        return $this->put('users/users/'.rawurlencode($id), $fields);
    }
1014591
public function copy($id)
    {
        $uriAppend = 'copy/' . $id;

        $response = $this->handler->handle('POST', false, $uriAppend);

        return $this->make($response, false);
    }
143661
public function edit($id)
    {
        $field = $this->fields->findById($id);
        $fieldTypes = $this->fields->getFieldTypes();

        if (! $field) {
            return $this->handleError(trans('soda::errors.not-found', ['object' => trans('soda::terminology.field')]));
        }

        app('soda.interface')->setHeading($field->name);
        app('soda.interface')->breadcrumbs()->addLink(route('soda.fields.index'), ucwords(trans('soda::terminology.field_plural')));

        return soda_cms_view('data.fields.view', compact('field', 'fieldTypes'));
    }
756039
public function getVersions ($list, $id, $field = null) {
	    return $this->getFieldVersions($list, $id, $field);
	}
507030
public function getById($id)
    {
        $database = DatabaseLayer::getInstance();
        $select = $database->select($this->getTableName(), $this->getTableAlias());
        $select->fields($this->getTableAlias());
        $select->condition($this->getIDField(), $id);
        $results = $select->execute(get_called_class());
        $result = end($results);
        return $result;
    }
1046809
public function patchUser($id, array $fields)
    {
        $request = $this->client->patch($this->customer['url'].'/api/users/'.$id);

        $request->setAuth($this->customer['username'], $this->customer['password']);
        $request->setBody(json_encode($fields));

        $response = $request->send();

        return json_decode($response->getBody(true));
    }
1304232
public function record($id)
    {
        $recs = $this->get('recLoadAll');

        $records = array_get($recs, 'response.recs.objs');

        foreach ($records as $record) {
            if ((int) $record['rec_id'] === (int) $id) {
                return new Record($this->client, (int) $id, $this, ['recLoad' => $record]);
            }
        }
    }
1255623
public function get(int $id, $params = [])
    {
        if ($this->fields) {
            $params['fields'] = implode(',', $this->fields);
        }

        $uriAppend = 'byId/' . $id;
        $response  = $this->handler->handle('GET', false, $uriAppend, $params);

        return $this->make($response, false);
    }
870186
public function createEditForm($id) {
        $entity = $this->read_handler->get($id);
        return $form = $this->doCreate($this->getDefaultTypeClass(), $entity);
    }
870210
public function getEdit($id = '')
    {
        $model = (!empty($id) || $id === "0") ? $this->findAutoDetectTranslation($id) : $this->model;
        $form  = FormBuilder::create(get_class($this->form), [
            'model' => $model
        ]);


        if ($this->isTranslatableModel()) {
            $local_overide = $this->model->getIso($model->getTable(), $model->id);
            if (!empty($local_overide)) {
                $form->add('local_override', 'hidden', ['default_value' => $local_overide]);
            }
        }

        $form_content = view('form-builder::form.components.formgenerator.full', [
            'form' => $form
        ]);

        $this->layoutManager->add([
            'content' => view('expendable::admin.form.state.form', [
                'form' => $form_content
            ])
        ]);

        return $this->layoutManager->render();
    }
983269
public function setId(int $id): Field
    {
        Assert::greaterThan($id, 0);

        $this->id = $id;

        return $this;
    }
629101
public function getEditForm($id = null, $fields = null)
    {
        $fields = FieldList::create();
        $modelClass = $this->request->getVar('others') ? 'others' : $this->modelClass;
        $classInst = Injector::inst()->get($this->modelClass);

        if (ClassInfo::hasMethod($classInst, 'getArchiveField')) {
            $listField = $classInst->getArchiveField();
            $fields->push($listField);
        } else {
            $otherVersionedObjects = $this->getVersionedModels('other');
            $modelSelectField = $this->getOtherModelSelectorField($modelClass);
            $fields->push($modelSelectField);

            // If a valid other model name is passed via a request param
            // then show a gridfield with archived records
            if (array_search($modelClass, $otherVersionedObjects)) {
                $listField = $this->createArchiveGridField('Others', $modelClass);

                $listColumns = $listField->getConfig()->getComponentByType(GridFieldDataColumns::class);
                $listColumns->setDisplayFields([
                    'Title' => _t(__CLASS__ . '.COLUMN_TITLE', 'Title'),
                    'Versions.first.LastEdited' => _t(__CLASS__ . '.COLUMN_DATEARCHIVED', 'Date Archived'),
                    'Versions.first.Author.Name' => _t(__CLASS__ . '.COLUMN_ARCHIVEDBY', 'Archived By'),
                ]);
                $listColumns->setFieldFormatting([
                    'Versions.first.LastEdited' => function ($val, $item) {
                        return DBDatetime::create_field('Datetime', $val)->Ago();
                    },
                ]);

                $fields->push($listField);
            }
        }

        $form = Form::create(
            $this,
            'EditForm',
            $fields,
            FieldList::create()
        )->setHTMLID('Form_EditForm');
        $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
        $form->setAttribute('data-pjax-fragment', 'CurrentForm');
        $form->addExtraClass(
            'ArchiveAdmin discardchanges cms-edit-form cms-panel-padded center flexbox-area-grow '.
            $this->BaseCSSClasses()
        );
        $form->setFormAction(Controller::join_links(
            $this->Link($this->sanitiseClassName($this->modelClass)),
            'EditForm'
        ));

        $this->extend('updateEditForm', $form);

        return $form;
    }
1206123
public function apiShow (string $id)
    {
        $with = [];

        $select = HCResources::getFillableFields ();

        $record = HCResources::with ($with)
            ->select ($select)
            ->where ('id', $id)
            ->firstOrFail ();

        return $record;
    }
788649
public function getClient($id)
    {
        $response = $this->get('/en/client/edit/id/' . $id);

        $content = trim($this->getBetween((string)$response->getBody(), '<table class="wide">', "</table>"));

        $client = new Client(array(
            'id' => $id,
            'email' => $this->getBetween($content, '<input type="text" name="email" id="email" value="', '">'),
            'first_name' => $this->getBetween($content, '<input type="text" name="first_name" id="first_name" value="', '">'),
            'last_name' => $this->getBetween($content, '<input type="text" name="last_name" id="last_name" value="', '">'),
            'company' => $this->getBetween($content, '<input type="text" name="company" id="company" value="', '">'),
            'address_1' => $this->getBetween($content, '<input type="text" name="address_1" id="address_1" value="', '">'),
            'address_2' => $this->getBetween($content, '<input type="text" name="address_2" id="address_2" value="', '">'),
            'country' => $this->getBetweenReverse($content, '<option value="', '" selected="selected">'),
            'city' => $this->getBetween($content, '<input type="text" name="city" id="city" value="', '">'),
            'state' => $this->getBetween($content, '<input type="text" name="state" id="state" value="', '">'),
            'zip' => $this->getBetween($content, '<input type="text" name="zip" id="zip" value="', '">'),
            'phone_cc' => $this->getBetween($content, '<input type="text" name="phone_cc" id="phone_cc" value="', '">'),
            'phone' => $this->getBetween($content, '<input type="text" name="phone" id="phone" value="', '">'),
        ));

        return $client;
    }
895459
public function setId($Id) 
    {
        if (!$this->_isNumericArray($Id)) {
            $Id =  array ($Id);    
        }
        $this->fields['Id']['FieldValue'] = $Id;
        return $this;
    }