本文整理汇总了PHP中Fields::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP Fields::getErrors方法的具体用法?PHP Fields::getErrors怎么用?PHP Fields::getErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fields
的用法示例。
在下文中一共展示了Fields::getErrors方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: NewCompany
/**
* Create new company
*
* @param array $add_values
* @return int
*/
public function NewCompany(array $add_values)
{
$this->add_value = $add_values;
if (CheckGroupAllow('company_add_capcha')) {
if (!$this->CheckCapcha()) {
return false;
}
}
if (!$this->member['id'] && $this->config['company_allow_reg']) {
$this->CheckRegisterUser();
}
if ($this->dbase->SelectOne('job_companies', array("company_id"), array("name" => $this->add_value['name']))) {
$this->Errors[] = $this->lang['company_error_name_exist'];
}
$this->CheckCompanyError();
if (!$this->Errors && !$this->member['id'] && $this->config['company_allow_reg']) {
$this->RegisterUser();
}
$this->add_value['xfields'] = $this->xfields->EncodeFields($this->add_value);
$this->Errors = $this->Errors + $this->xfields->getErrors();
if (!$this->Errors) {
$this->add_value['user_id'] = $this->member['id'];
$this->add_value['user_name'] = $this->member['name'];
return $this->AddCompany();
} else {
return 0;
}
}
示例2: tryAddCol
private static function tryAddCol($model, $col, $type)
{
if (!Fields::model()->findByAttributes(array('fieldName' => $col, 'modelName' => get_class($model)))) {
$field = new Fields();
$field->setAttributes(array('modelName' => get_class($model), 'fieldName' => $col, 'attributeLabel' => $col, 'modified' => '1', 'custom' => 1, 'type' => $type, 'required' => '0', 'uniqueConstraint' => '0', 'safe' => '1', 'readOnly' => '0', 'linkType' => NULL, 'searchable' => '0', 'relevance' => 'Low', 'isVirtual' => '0', 'defaultValue' => NULL, 'keyType' => '', 'data' => NULL), false);
if (!$field->save()) {
AuxLib::debugLogR('$col = ');
AuxLib::debugLogR($col);
AuxLib::debugLogR($field->getErrors());
}
}
}
示例3: Add
public function Add($value_array)
{
$this->values = $value_array;
$this->CheckError();
require_once ENGINE_DIR . '/car-market/classes/Fields.php';
$xfields = new Fields($this->base, $this);
$this->values['xfields'] = $xfields->EncodeFields($this->values);
$this->Errors = $this->Errors + $xfields->getErrors();
if ($this->Errors) {
return false;
}
$this->PreparationValues();
$this->values['add_date'] = $this->values['update_date'] = $this->base->timer->cur_time;
$this->values['author'] = $this->member['name'];
$this->values['author_id'] = $this->member['id'];
$this->values['author_ip'] = $this->member['ip'];
$id = $this->base->Insert('auto_autos', $this->values);
if (!empty($this->values['images'])) {
$this->values['images'] = array_slice($this->values['images'], 0, $this->config['count_photo'][$this->member['group']]);
if ($this->values['images']) {
$this->base->SetWhere('id', $this->values['images'], 'IN', 'auto_images');
$this->base->Update('auto_images', array('auto_id' => $id), array('auto_id' => 0));
if (!(int) $this->values['main_photo']) {
$this->values['main_photo'] = reset($this->values['images']);
}
$this->base->Update('auto_autos', array('photo' => $this->values['main_photo'], 'photo_count' => count($this->values['images'])), array('id' => $id));
}
}
if (!empty($_FILES['photo']['name'][0]) && $this->UploadPhoto($id)) {
$this->base->Update('auto_autos', array('photo' => $this->values['photo'], 'photo_count' => $this->values['photo_count']), array('id' => $id));
}
if (!empty($this->values['allow_site'])) {
$this->IncrementCounter($this->values['mark_id'], $this->values['model_id']);
Cache::ClearAllCache();
}
return $id;
}
示例4: Add
public function Add($values_array)
{
if (!in_array($this->member['group'], $this->config['user_int_allow_no_code'])) {
$sec_code_session = $_SESSION['sec_code_session'] != '' ? $_SESSION['sec_code_session'] : false;
$_SESSION['sec_code_session'] = false;
if ($_POST['sec_code'] != $sec_code_session or !$sec_code_session) {
$this->Errors[] = $this->lang['error_code'];
}
}
if (!$GLOBALS['is_logged'] && $this->config['general_allow_reg']) {
$parse = new ParseFilter(array(), array(), 1, 1);
$password1 = $this->base->EscapeString($parse->process($_POST['password1']));
$password2 = $this->base->EscapeString($parse->process($_POST['password2']));
$name = $this->base->EscapeString($parse->process(htmlspecialchars(trim($_POST['name']))));
$email = $this->base->EscapeString($parse->process(htmlspecialchars(trim($_POST['email']))));
$member_id = $GLOBALS['db']->super_query("SELECT * FROM " . USERPREFIX . "_users where name='{$name}' and password='" . md5(md5($password1)) . "'");
if ($member_id) {
$this->LoginIn($password1);
$GLOBALS['member_id'] = $member_id;
$this->member['id'] = $member_id['user_id'];
$this->member['name'] = $member_id['name'];
$this->member['group'] = $member_id['user_group'];
$this->member['ip'] = $member_id['logged_ip'];
$this->guest_session = '';
} else {
auto_check_reg($name, $email, $password1, $password2);
}
}
$this->values = $values_array;
$this->CheckError();
require_once ENGINE_DIR . '/car-market/classes/Fields.php';
$xfields = new Fields($this->base, $this);
$this->values['xfields'] = $xfields->EncodeFields($this->values);
$this->Errors = $this->Errors + $xfields->getErrors();
if ($this->Errors) {
return false;
}
if (!$GLOBALS['is_logged'] && $this->config['general_allow_reg']) {
if (intval($GLOBALS['config']['reg_group']) < 3) {
$GLOBALS['config']['reg_group'] = 4;
}
$regpassword = md5(md5($password1));
$GLOBALS['db']->query("INSERT INTO " . USERPREFIX . "_users (name, password, email, reg_date, lastdate, user_group, info, signature, favorites, xfields, logged_ip) VALUES ('{$name}', '{$regpassword}', '{$email}', '{$this->base->timer->cur_time}', '{$this->base->timer->cur_time}', '" . $GLOBALS['config']['reg_group'] . "', '', '', '', '', '" . $this->member['ip'] . "')");
$this->member['id'] = $GLOBALS['db']->insert_id();
$this->member['name'] = $name;
$this->member['group'] = $GLOBALS['config']['reg_group'];
$guest_session = $this->guest_session;
$this->guest_session = '';
$this->LoginIn($password1);
}
// if ($this->values['capacity_motor'] > 1000)
// {
// $this->values['capacity_motor'] = $this->values['capacity_motor']/1000;
// }
$this->PreparationValues();
if (in_array($this->member['group'], $this->config['user_int_allow_change_exp'])) {
if ($this->values['count_day']) {
$this->values['exp_date'] = $this->base->timer->cur_time + (int) $this->values['count_day'] * 24 * 60 * 60;
} else {
$this->values['exp_date'] = 0;
}
} elseif ($this->config['user_int_default_day_count']) {
$this->values['exp_date'] = $this->base->timer->cur_time + (int) $this->config['user_int_default_day_count'] * 24 * 60 * 60;
} else {
$this->values['exp_date'] = 0;
}
if (in_array($this->member['group'], $this->config['user_int_allow_no_moder'])) {
$this->values['allow_site'] = 1;
}
$this->values['guest_session'] = $this->guest_session;
$this->values['add_date'] = $this->values['update_date'] = $this->base->timer->cur_time;
$this->values['author'] = $this->member['name'];
$this->values['author_id'] = $this->member['id'];
$this->values['author_ip'] = $this->member['ip'];
$id = $this->base->Insert('auto_autos', $this->values);
if (!empty($this->values['images'])) {
$this->values['images'] = array_slice($this->values['images'], 0, $this->config['count_photo'][$this->member['group']]);
if ($this->values['images']) {
$this->base->SetWhere('id', $this->values['images'], 'IN', 'auto_images');
if ($this->member['id']) {
$this->base->Update('auto_images', array('auto_id' => $id), array('auto_id' => 0, 'user_id' => $this->member['id']));
} else {
if (!empty($guest_session)) {
$this->base->Update('auto_images', array('auto_id' => $id, 'user_id' => $this->member['id'], 'guest_session' => ''), array('auto_id' => 0, 'guest_session' => $guest_session));
} else {
$this->base->Update('auto_images', array('auto_id' => $id), array('auto_id' => 0, 'guest_session' => $this->guest_session));
}
}
if (!(int) $this->values['main_photo']) {
$this->values['main_photo'] = reset($this->values['images']);
}
$this->base->Update('auto_autos', array('photo' => $this->values['main_photo'], 'photo_count' => count($this->values['images'])), array('id' => $id));
}
}
if (!empty($_FILES['photo']['name'][0]) && $this->UploadPhoto($id)) {
$this->base->Update('auto_autos', array('photo' => $this->values['photo'], 'photo_count' => $this->values['photo_count']), array('id' => $id));
}
if (!empty($this->values['allow_site'])) {
$this->IncrementCounter($this->values['mark_id'], $this->values['model_id']);
Cache::ClearAllCache();
//.........这里部分代码省略.........
示例5: NewResume
/**
* Create new resume
*
* @param array $add_values
*/
public function NewResume(array $add_values)
{
$this->add_value = $add_values;
$this->CheckResumeError();
$xfields = new Fields(XFIELDS_RESUME, $this);
$this->add_value['xfields'] = $xfields->EncodeFields($this->add_value);
$this->Errors = $this->Errors + $xfields->getErrors();
$this->add_value['date_exp'] = strtotime($this->add_value['date_exp']);
if (!$this->Errors) {
return $this->AddResume();
} else {
return 0;
}
}
示例6: Save
public function Save($values_array, $old = array())
{
if (empty($values_array['id'])) {
return false;
}
$this->values = $values_array;
$this->CheckError();
require_once ENGINE_DIR . '/car-market/classes/Fields.php';
$xfields = new Fields($this->base, $this);
$this->values['xfields'] = $xfields->EncodeFields($this->values);
$this->Errors = $this->Errors + $xfields->getErrors();
if ($this->Errors) {
return false;
}
if ($old) {
$this->old_values = $old;
} elseif (!($this->old_values = $this->base->SelectOne('auto_autos', array('*'), array('id' => $this->values['id'])))) {
throw new ExceptionAllError("Автомобиль не обнаружен");
}
$this->PreparationValues();
$this->values['update_date'] = $this->base->timer->cur_time;
if (!empty($this->values['images'])) {
$this->values['images'] = array_slice($this->values['images'], 0, $this->config['count_photo'][$this->member['group']]);
if ($this->values['images']) {
if (!(int) $this->values['main_photo']) {
$this->values['main_photo'] = reset($this->values['images']);
}
$this->base->Update('auto_autos', array('photo' => $this->values['main_photo'], 'photo_count' => count($this->values['images'])), array('id' => $this->values['id']));
}
}
if (!empty($_FILES['photo']['name'][0])) {
$this->UploadPhoto($this->values['id'], $this->old_values['photo_count']);
}
$this->base->Update('auto_autos', $this->values, array('id' => $this->values['id']));
if ($this->values['allow_site']) {
if (!$this->old_values['allow_site']) {
$this->IncrementCounter($this->values['mark_id'], $this->values['model_id']);
} elseif ($this->values['model_id'] != $this->old_values['model_id']) {
$this->DecrementCounter($this->old_values['mark_id'], $this->old_values['model_id']);
$this->IncrementCounter($this->values['mark_id'], $this->values['model_id']);
}
Cache::ClearHTMLCache();
} elseif ($this->old_values['allow_site']) {
$this->DecrementCounter($this->old_values['mark_id'], $this->old_values['model_id']);
}
return true;
}
示例7: SaveResume
/**
* Save editing resume
*
* @param int $id
* @return boolean
*/
protected function SaveResume($id)
{
$this->CheckResumeError();
$xfields = new Fields(XFIELDS_RESUME, $this);
$this->add_value['xfields'] = $xfields->EncodeFields($this->add_value);
$this->Errors = $this->Errors + $xfields->getErrors();
if (!$this->Errors) {
$this->PreparationResumeValues();
if (!empty($_FILES['photo']['name']) || !empty($this->add_value['del_photo']) && $this->old_value['photo']) {
@unlink(PHOTO_PATCH . $this->old_value['photo']);
}
$this->dbase->Update('job_resumes', $this->add_value, array('id' => $id));
return true;
} else {
return false;
}
}