本文整理汇总了PHP中ORM::preSubmit方法的典型用法代码示例。如果您正苦于以下问题:PHP ORM::preSubmit方法的具体用法?PHP ORM::preSubmit怎么用?PHP ORM::preSubmit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ORM
的用法示例。
在下文中一共展示了ORM::preSubmit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preSubmit
protected function preSubmit()
{
if (array_key_exists('verified_status', $this->submission['fields'])) {
$rs = $this->submission['fields']['verified_status']['value'];
// If we are making it verified in the submitted data, but we don't already have a verifier in
// the database
if ($rs == 'V' && !$this->verified_by_id) {
$defaultUserId = Kohana::config('indicia.defaultPersonId');
// Set the verifier to the logged in user, or the default user ID from config if not logged
// into Warehouse, if it is not in the submission
if (!array_key_exists('verified_by_id', $this->submission['fields'])) {
$this->submission['fields']['verified_by_id']['value'] = isset($_SESSION['auth_user']) ? $_SESSION['auth_user'] : $defaultUserId;
}
// and store the date of the verification event if not specified.
if (!array_key_exists('verified_on', $this->submission['fields'])) {
$this->submission['fields']['verified_on']['value'] = date("Ymd H:i:s");
}
} else {
// Completed or in progress data not verified
$this->submission['fields']['verified_by_id']['value'] = '';
$this->submission['fields']['verified_on']['value'] = '';
}
}
parent::preSubmit();
}
示例2: preSubmit
protected function preSubmit()
{
// Call the parent preSubmit function
parent::preSubmit();
// Set scientific if latin
$l = ORM::factory('language');
$sci = 'f';
/*if ($l->find($this->submission['fields']['language_id']['value'])->iso == "lat") {
$sci = 't';
}*/
$this->submission['fields']['scientific'] = array('value' => $sci);
}
示例3: preSubmit
public function preSubmit()
{
if (isset($this->submission['fields']['email_address'])) {
if ($this->submission['fields']['email_address']['value'] == '') {
$this->submission['fields']['email_address']['value'] = NULL;
}
}
if (isset($this->submission['fields']['title_id'])) {
if (!is_numeric($this->submission['fields']['title_id']['value'])) {
$this->submission['fields']['title_id']['value'] = NULL;
}
}
return parent::preSubmit();
}
示例4: preSubmit
public function preSubmit()
{
if (isset($this->submission['fields']['core_role_id'])) {
if (!is_numeric($this->submission['fields']['core_role_id']['value'])) {
$this->submission['fields']['core_role_id']['value'] = NULL;
}
}
// Set boolean field defaults as not in form submission if not checked. This is not required if the view is
// switched to the data_entry_helper controls.
$this->submission['fields']['email_visible'] = array('value' => isset($this->submission['fields']['email_visible']) ? 't' : 'f');
$this->submission['fields']['view_common_names'] = array('value' => isset($this->submission['fields']['view_common_names']) ? 't' : 'f');
$this->submission['fields']['allow_share_for_reporting'] = array('value' => isset($this->submission['fields']['allow_share_for_reporting']) ? 't' : 'f');
$this->submission['fields']['allow_share_for_peer_review'] = array('value' => isset($this->submission['fields']['allow_share_for_peer_review']) ? 't' : 'f');
$this->submission['fields']['allow_share_for_verification'] = array('value' => isset($this->submission['fields']['allow_share_for_verification']) ? 't' : 'f');
$this->submission['fields']['allow_share_for_data_flow'] = array('value' => isset($this->submission['fields']['allow_share_for_data_flow']) ? 't' : 'f');
$this->submission['fields']['allow_share_for_moderation'] = array('value' => isset($this->submission['fields']['allow_share_for_moderation']) ? 't' : 'f');
// Ensure that the website fields remain available (as they are not proper model columns so get
// stripped from the model).
$this->droppedFields = array_diff_key($this->submission['fields'], $this->table_columns);
return parent::preSubmit();
}
示例5: preSubmit
protected function preSubmit()
{
//If determination logging is on and the occurrence species has changed ($logDetermination is true), we can
//set the determiner_id on the occurrence to the current user providing easy login is on ($currentUserId!==1).
if ($this->logDetermination) {
$currentUserId = $this->get_current_user_id();
if ($currentUserId !== 1) {
$this->submission['fields']['determiner_id']['value'] = $currentUserId;
}
}
if (array_key_exists('record_status', $this->submission['fields'])) {
$rs = $this->submission['fields']['record_status']['value'];
// If we are making it verified in the submitted data, but we don't already have a verifier in
// the database
if (($rs == 'V' || $rs == 'R') && !$this->verified_by_id) {
$defaultUserId = Kohana::config('indicia.defaultPersonId');
// Set the verifier to the logged in user, or the default user ID from config if not logged
// into Warehouse, if it is not in the submission
if (!array_key_exists('verified_by_id', $this->submission['fields'])) {
$this->submission['fields']['verified_by_id']['value'] = isset($_SESSION['auth_user']) ? $_SESSION['auth_user'] : $defaultUserId;
}
// and store the date of the verification event if not specified.
if (!array_key_exists('verified_on', $this->submission['fields'])) {
$this->submission['fields']['verified_on']['value'] = date("Ymd H:i:s");
}
} elseif ($rs == 'C' || $rs == 'I') {
// Completed or in progress data not verified
$this->submission['fields']['verified_by_id']['value'] = '';
$this->submission['fields']['verified_on']['value'] = '';
}
}
parent::preSubmit();
}