本文整理汇总了PHP中has_error函数的典型用法代码示例。如果您正苦于以下问题:PHP has_error函数的具体用法?PHP has_error怎么用?PHP has_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了has_error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: has_error
echo has_error("yearlevelAlias") ? "has-error" : (has_success("yearlevelAlias") ? "has-success" : "");
?>
">
<label for="yearlevelAliasinput" class="col-sm-4 control-label">Year Alias</label>
<div class="col-sm-8">
<input name="yearlevelAlias" type="text" id="yearlevelAliasinput" class="form-control" value="<?php
echo set_value("yearlevelAlias", $yearlevelinfo ? $yearlevelinfo->yearlevel_alias : "");
?>
" />
<?php
echo has_message("yearlevelAlias") ? '<span class="help-block">' . get_message("yearlevelAlias") . '</span>' : "";
?>
</div>
</div>
<div class="form-group <?php
echo has_error("yearlevelDescription") ? "has-error" : (has_success("yearlevelDescription") ? "has-success" : "");
?>
">
<label for="yearlevelDescriptioninput" class="col-sm-4 control-label">Year level Description</label>
<div class="col-sm-8">
<input name="yearlevelDescription" type="text" id="yearlevelDescriptioninput" class="form-control" value="<?php
echo set_value("yearlevelDescription", $yearlevelinfo ? $yearlevelinfo->yearlevel_description : "");
?>
" />
<?php
echo has_message("yearlevelDescription") ? '<span class="help-block">' . get_message("yearlevelDescription") . '</span>' : "";
?>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
开发者ID:shemehs,项目名称:shine19395,代码行数:31,代码来源:content.php
示例2: update
public function update()
{
$id = isset($_POST['id']) ? intval($_POST['id']) : 0;
$data = $_POST;
$data['id'] = $id;
$data['is_complete'] = isset($data['is_complete']) ? SERIES_STATUS_COMPLETE : SERIES_STATUS_ONGOING;
$obj = $this->Series_model->getById($id);
$data['thumbnail'] = $obj['thumbnail'];
$message = $this->validate($data, TRUE);
if (!empty($message)) {
set_flash_error($message);
}
$listGenre = $this->Genre_model->getAll();
$defaultGenre = isset($data['genre']) ? $data['genre'] : array();
$genreSelectbox = selectBox($listGenre, array('Name' => 'genre[]', 'multiple' => 'multiple', 'size' => 10, 'Selected' => $defaultGenre));
$data['genreSelectbox'] = $genreSelectbox;
$statusSelectbox = selectBox($this->_config['status'], array('Name' => 'status', 'Selected' => $data['status']));
$data['statusSelectbox'] = $statusSelectbox;
$countrySelectbox = selectBox($this->_config['countries'], array('Name' => 'country', 'Selected' => $data['country']));
$data['countrySelectbox'] = $countrySelectbox;
$typeSelectbox = selectBox($this->_config['video_type'], array('Name' => 'type', 'Selected' => $data['type']));
$data['typeSelectbox'] = $typeSelectbox;
if (!has_error()) {
$canUpdate = FALSE;
if (!empty($_FILES) && !empty($_FILES['thumbnail']['tmp_name'])) {
$result = upload_image($_FILES, SERIE_IMAGE_THUMBNAIL_PATH);
if ($result['error'] != 0) {
$this->layout->title('Edit video');
$this->layout->view('admin_series/edit', $data);
} else {
$data['thumbnail'] = $result['fileName'];
$this->_deleteImage($id);
$canUpdate = TRUE;
}
} else {
$canUpdate = TRUE;
}
if ($canUpdate) {
$id = $this->Series_model->update($id, $data);
$this->Series_Genre_model->deleteBySeriesId($id);
if ($data['genre']) {
foreach ($data['genre'] as $genreId) {
$seriesGenreData = array();
$seriesGenreData['genre_id'] = $genreId;
$seriesGenreData['series_id'] = $id;
$this->Series_Genre_model->insert($seriesGenreData);
}
}
$url = base_url() . 'admin_series/index';
set_flash_message($this->lang->line('admin.series.updated'));
redirect($url);
}
} else {
$this->layout->title('Edit series');
$this->layout->view('admin_series/edit', $data);
}
}
开发者ID:pdkhuong,项目名称:VideoFW,代码行数:57,代码来源:Admin_series.php
示例3: foreach
foreach ($q as $college) {
echo '<option value="' . htmlspecialchars($college['id']) . '" ';
if ($user['college_id'] === $college['id']) {
echo "selected";
}
echo ">" . htmlspecialchars($college['name']) . "</option>\n";
}
?>
</select>
<?php
show_error('college');
?>
</div>
<div class='form-group col-md-6 <?php
echo has_error('campus');
?>
'>
<label>Campus</label>
<select name='campus' class='form-control'>
<option value=""> Select Campus </option>
<?php
echo "<option value='1' ";
if ($user['campus_id'] == 1) {
echo "selected='selected'";
}
echo "> Corvallis (Main)</option>";
echo "<option value='2' ";
if ($user['campus_id'] == 2) {
echo "selected='selected'";
}
开发者ID:magical,项目名称:cs290-project,代码行数:31,代码来源:profile_edit.php
示例4: isset
<div class="panel panel-primary">
<div class="panel-heading">
<p class="panel-title">
Edit curriculum type
</p>
</div>
<div class="panel-body">
<?php
$curriculumtypeinfo = isset($curriculumtypeinfo) ? $curriculumtypeinfo : false;
$form_attr = array("class" => "form-horizontal");
$form_hidden = array(sha1("editcurriculumtype") => sha1(random_string("alnum", 5)));
echo form_open("dashboard/curriculums/settings/types/" . ($curriculumtypeinfo ? $curriculumtypeinfo->getCurriculumtypeid() : 0) . "/edit", $form_attr, $form_hidden);
?>
<div class="form-group <?php
echo has_error("curriculumType") ? "has-error" : (has_success("curriculumType") ? "has-success" : "");
?>
">
<label for="curriculumTypeinput" class="col-sm-4 control-label">Curriculum type</label>
<div class="col-sm-8">
<input name="curriculumType" type="text" id="curriculumTypeinput" class="form-control" value="<?php
echo set_value("curriculumType", $curriculumtypeinfo ? $curriculumtypeinfo->curriculum_type : "");
?>
" />
<?php
echo has_message("curriculumType") ? '<span class="help-block">' . get_message("curriculumType") . '</span>' : "";
?>
</div>
</div>
<div class="form-group">
开发者ID:shemehs,项目名称:shine19395,代码行数:31,代码来源:content.php
示例5: has_error
echo has_error("majorCode") ? "has-error" : (has_success("majorCode") ? "has-success" : "");
?>
">
<label for="majorCodeinput" class="col-sm-4 control-label">Major Code</label>
<div class="col-sm-8">
<input name="majorCode" type="text" id="majorCodeinput" class="form-control" value="<?php
echo set_value("majorCode", $majorinfo ? $majorinfo->major_code : "");
?>
" />
<?php
echo has_message("majorCode") ? '<span class="help-block">' . get_message("majorCode") . '</span>' : "";
?>
</div>
</div>
<div class="form-group <?php
echo has_error("majorDescription") ? "has-error" : (has_success("majorDescription") ? "has-success" : "");
?>
">
<label for="majorDescriptioninput" class="col-sm-4 control-label">Major Description</label>
<div class="col-sm-8">
<?php
$majorDescriptioninput = array('name' => 'majorDescription', 'class' => "form-control", 'id' => 'majorDescriptioninput', 'value' => set_value("majorDescription", $majorinfo ? $majorinfo->major_description : ""), 'rows' => '3');
echo form_textarea($majorDescriptioninput);
?>
<?php
echo has_message("majorDescription") ? '<span class="help-block">' . get_message("majorDescription") . '</span>' : "";
?>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
开发者ID:shemehs,项目名称:shine19395,代码行数:31,代码来源:content.php
示例6: foreach
}
}
$ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/courses/groups?section=manage&id=" . $COURSE_ID . "&gid=" . $GROUP_ID . "\\'', 5000)";
break;
case 'managetutors':
$query = "DELETE FROM `course_group_contacts` WHERE `cgroup_id` = " . $db->qstr($GROUP_ID);
if ($db->Execute($query)) {
if (is_array($PROCESSED["associated_tutors"]) && count($PROCESSED["associated_tutors"])) {
foreach ($PROCESSED["associated_tutors"] as $contact_order => $proxy_id) {
$contact_details = array("cgroup_id" => $GROUP_ID, "proxy_id" => $proxy_id, "contact_order" => (int) $contact_order, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID());
if (!$db->AutoExecute("course_group_contacts", $contact_details, "INSERT")) {
add_error("There was an error while trying to attach an <strong>Associated Tutor</strong> to this course group.<br /><br />The system administrator was informed of this error; please try again later.");
application_log("error", "Unable to insert a new course_group_contact record while managing a course group. Database said: " . $db->ErrorMsg());
}
}
if (!has_error()) {
add_success("Successfully updated the tutors for the selected course group.");
}
} else {
add_success("Successfully removed all tutors from the selected course group.");
}
} else {
add_error("There was an error while trying to remove the <strong>Associated Tutor(s)</strong> from this course group.<br /><br />The system administrator was informed of this error; please try again later.");
application_log("error", "Unable to remove a course_group_contact record while managing a course group. Database said: " . $db->ErrorMsg());
}
$ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/courses/groups?section=manage&id=" . $COURSE_ID . "&gid=" . $GROUP_ID . "\\'', 5000)";
break;
case 'delete':
$removed = array();
foreach ($GROUP_IDS as $group_id) {
if ($group_id = (int) $group_id) {
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:31,代码来源:edit.inc.php
示例7: get_value
echo '<option value="' . $subjectinfo->getSubjectid() . '" ' . (has_value("cssubjectUnit") ? get_value("cssubjectId") == $subjectinfo->getSubjectid() ? ' selected = "selected" ' : "" : set_select("cssubjectId", $subjectinfo->getSubjectid())) . '>';
echo $subjectinfo->subject_code . " ( " . $subjectinfo->subject_description . " )";
echo '</option>';
}
}
?>
</select>
<span class="help-block"><?php
echo has_message("cssubjectId") ? get_message("cssubjectId") : "";
?>
</span>
</div>
</div>
<div class="form-group <?php
echo has_error("cssubjectUnit", "has-error", has_success("cssubjectUnit", "has-success"));
?>
">
<label for="subjectUnitinput" class=" control-label col-sm-4">Unit</label>
<div class="col-sm-5">
<div class="input-group input-append spinner" data-trigger="spinner">
<input value="<?php
echo has_value("cssubjectUnit") ? get_value("cssubjectUnit") : set_value("cssubjectUnit", 0);
?>
" type="text" class="form-control" name="cssubjectUnit" id="subjectUnitinput" data-max="10" data-min="0" data-step="1" data-rule="quantity" />
<span class="input-group-addon add-on">
<a href="#" class="spin-up" data-spin="up">
<span class="glyphicon glyphicon-triangle-top icon-sort-up"></span>
</a>
<a href="#" class="spin-down" data-spin="down">
开发者ID:shemehs,项目名称:shine19395,代码行数:31,代码来源:content.php
示例8: update_progress_bar
update_progress_bar('records', 50, 100);
add_to_msg('Sending ' . sizeof($altered_relation['entry_list']) . ' Modified Relationship Records<br>', false);
$result = $soapclient->call('sync_set_relationships', array('session' => $session, 'module_name' => $sync_module, 'related_module' => $related, 'from_date' => $last_sync, 'to_date' => $start_time, 'sync_entry_list' => $commit_relation, 'deleted' => -1));
}
update_progress_bar('records', 100, 100);
}
if ($rel_offset > 0 || !has_error($result)) {
update_progress_bar('records', 0, 100);
$next_off = $rel_offset + $rel_max;
add_to_msg('Retrieving Server Relationships - ' . $related . "[{$rel_offset} - {$next_off}] <br>", false);
if ($clean_sync == 1) {
$result = $soapclient->call('get_quick_sync_data', array('session' => $session, 'module_name' => $sync_module, 'related_module_name' => $related, 'start' => $rel_offset, 'count' => $rel_max, 'db_type' => $sugar_config['dbconfig']['db_type'], 'deleted' => 2));
} else {
$result = $soapclient->call('sync_get_relationships', array('session' => $session, 'module_name' => $sync_module, 'related_module' => $related, 'from_date' => $last_sync, 'to_date' => $start_time, 'offset' => $rel_offset, 'max_results' => $rel_max, 'deleted' => 2));
}
if (!has_error($result)) {
update_progress_bar('records', 50, 100);
if ($clean_sync == 1) {
$result_arr = unserialize(base64_decode($result['result']));
execute_query($sync_module, $result_arr['data']);
execute_query($sync_module, $result_arr['cstm']);
} else {
$list = get_decoded($result['entry_list']);
$done = client_save_relationships($list);
add_to_msg('Retrieved ' . $result['result_count'] . ' Records<br>', false);
add_to_msg('Added ' . $done['add'] . ' Records <br>', false);
add_to_msg('Modified ' . $done['modify'] . ' Records <br>', false);
}
$total_count = $result['total_count'];
if ($result['next_offset'] < $result['total_count']) {
store_msg();
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:31,代码来源:Popup.php
示例9: show_errors
/**
* Displays all the errors.
*/
function show_errors()
{
if (has_error()) {
global $error_list;
echo '<div class="error">';
foreach ($error_list as $error) {
echo $error;
}
echo '</div>';
}
}
开发者ID:exaphaser,项目名称:pingouin,代码行数:14,代码来源:functions.php
示例10: add_to_msg
if ($sync_module_index == -1) {
add_to_msg("Logging Into Server...");
}
$result = $soapclient->call('login', array('user_auth' => sync_get_user_auth_data(), 'application_name' => 'MobileClient'));
if (!has_error($result)) {
$session = $result['id'];
$_SESSION['sync_session'] = $session;
//ensure that this system has not been disabled
global $sugar_config;
global $sugar_flavor;
global $sugar_version;
$soapclient->setHeaders('sugar_version=' . $sugar_version);
$result = $soapclient->call('get_system_status', array('session' => $session, 'unique_key' => $sugar_config['unique_key']));
if (!has_error($result) && $result['id'] == 0) {
$result = $soapclient->call('get_sugar_flavor', array());
if (!has_error($result) && $result == $sugar_flavor) {
if ($sync_module_index == -1) {
add_to_msg('Updating Files -<b>Please Wait</b>- <br><br>');
$current_step++;
update_progress_bar('sync_setup', $current_step, $module_steps);
if (isset($_REQUEST['new_sync'])) {
// run the file sync
require_once "include/utils/disc_client_utils.php";
$from_sync_client = true;
//before we do a file sync we need to install any necessary upgrades
$upgrade_applied = get_required_upgrades($soapclient, $session);
$results = disc_client_get_zip($soapclient, $session, true, 0, $upgrade_applied);
$_REQUEST['do_action'] = 'execute';
$_REQUEST['repair_silent'] = true;
$current_user->is_admin = 1;
echo "<div id='rrresult'></div>\n <script>\n var xmlhttp=false;\n /*@cc_on @*/\n /*@if (@_jscript_version >= 5)\n // JScript gives us Conditional compilation, we can cope with old IE versions.\n // and security blocked creation of the objects.\n try {\n xmlhttp = new ActiveXObject(\"Msxml2.XMLHTTP\");\n } catch (e) {\n try {\n xmlhttp = new ActiveXObject(\"Microsoft.XMLHTTP\");\n } catch (E) {\n xmlhttp = false;\n }\n }\n @end @*/\n if (!xmlhttp && typeof XMLHttpRequest!='undefined') {\n try {\n xmlhttp = new XMLHttpRequest();\n } catch (e) {\n xmlhttp = false;\n }\n }\n if (!xmlhttp && window.createRequest) {\n try {\n xmlhttp = window.createRequest();\n } catch (e) {\n xmlhttp = false;\n }\n }\n xmlhttp.onreadystatechange = function() {\n if(xmlhttp.readyState == 4) {\n document.getElementById('rrresult').innerHTML = xmlhttp.responseText;\n }\n }\n xmlhttp.open('GET', 'index.php?module=Sync&action=OfflineClientRepair', true);\n xmlhttp.send(null);\n </script>";
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:31,代码来源:syncconnect.php
示例11: display_status_messages
/**
* routine to display standard status messages, Error, Notice, and Success
* @param bool $fade true if the messages should fade out
*/
function display_status_messages($fade = false)
{
echo "<div class=\"status_messages\">";
if (has_error()) {
if ($fade) {
fade_element("out", "display-error-box");
}
echo display_error();
}
if (has_success()) {
if ($fade) {
fade_element("out", "display-success-box");
}
echo display_success();
}
if (has_notice()) {
if ($fade) {
fade_element("out", "display-notice-box");
}
echo display_notice();
}
echo "</div>";
}
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:27,代码来源:functions.inc.php
示例12: save
public function save()
{
$data = $_POST;
$importType = $this->_config['import_type'];
unset($importType[IMPORT_TYPE_COUNTRY]);
$importTypeSelectbox = selectBox($importType, array('Name' => 'import_type_id', 'Selected' => $data['import_type_id']));
$data['importTypeSelectbox'] = $importTypeSelectbox;
$typeSelectbox = selectBox($this->_config['video_type'], array('Name' => 'type', 'Selected' => $data['type']));
$data['typeSelectbox'] = $typeSelectbox;
$message = $this->validate($data);
if (!empty($message)) {
set_flash_error($message);
}
if (!has_error()) {
$siteUrl = strtolower($data['site_url']);
$id = 0;
$importTypeId = $data['import_type_id'];
if (strpos($siteUrl, "dramacool.com/")) {
if ($importTypeId == IMPORT_TYPE_VIDEO) {
$ret = $this->dramaCool->importFromVideoUrl($siteUrl);
} elseif ($importTypeId == IMPORT_TYPE_SERIES) {
$ret = $this->dramaCool->importFromSeriesUrl($siteUrl);
} elseif ($importTypeId == IMPORT_TYPE_COUNTRY) {
die;
//$ret = $this->dramaCool->importFromCountryUrl($siteUrl);
}
$id = $ret['id'];
}
if ($id) {
$url = base_url() . 'admin_video/show?id=' . $id;
set_flash_message($this->lang->line('admin.import.success'));
redirect($url);
} else {
set_flash_error($ret['msg']);
$this->layout->title('Import Data');
$this->layout->view('import_data/import', $data);
}
} else {
$this->layout->title('Import Data');
$this->layout->view('import_data/import', $data);
}
}
开发者ID:pdkhuong,项目名称:VideoFW,代码行数:42,代码来源:Import_data.php
示例13: has_error
echo has_error("semesterAlias") ? "has-error" : (has_success("semesterAlias") ? "has-success" : "");
?>
">
<label for="semesterAliasinput" class="col-sm-4 control-label">Semester Alias</label>
<div class="col-sm-8">
<input name="semesterAlias" type="text" id="semesterAliasinput" class="form-control" value="<?php
echo set_value("semesterAlias");
?>
" />
<?php
echo has_message("semesterAlias") ? '<span class="help-block">' . get_message("semesterAlias") . '</span>' : "";
?>
</div>
</div>
<div class="form-group <?php
echo has_error("semesterDescription") ? "has-error" : (has_success("semesterDescription") ? "has-success" : "");
?>
">
<label for="semesterDescriptioninput" class="col-sm-4 control-label">Semester Description</label>
<div class="col-sm-8">
<input name="semesterDescription" type="text" id="semesterDescriptioninput" class="form-control" value="<?php
echo set_value("semesterDescription");
?>
" />
<?php
echo has_message("semesterDescription") ? '<span class="help-block">' . get_message("semesterDescription") . '</span>' : "";
?>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
开发者ID:shemehs,项目名称:shine19395,代码行数:31,代码来源:content.php
示例14: update_box_item
public function update_box_item()
{
$id = isset($_POST['id']) ? intval($_POST['id']) : 0;
$data = $_POST;
$data['id'] = $id;
$obj = $this->Editor_Box_Item_model->getById($id);
$data['item_thumbnail'] = $obj['item_thumbnail'];
$originalThumb = $obj['item_thumbnail'];
$message = $this->validate_box_item($data, TRUE);
if (!empty($message)) {
set_flash_error($message);
}
$listBox = $this->Editor_Box_model->getAll();
$boxSelectbox = selectBox($listBox, array('Name' => 'box_id', 'MainOption' => TRUE, 'Selected' => $data['box_id']));
$data['boxSelectbox'] = $boxSelectbox;
if (!has_error()) {
$isUpload = FALSE;
$canUpdate = FALSE;
if (!empty($_FILES) && !empty($_FILES['item_thumbnail']['tmp_name'])) {
$result = upload_image($_FILES, EDITOR_IMAGE_THUMBNAIL_PATH);
if ($result['error'] != 0) {
$this->layout->title('Edit box item');
$this->layout->view('admin_editor/edit_box_item', $data);
} else {
$data['item_thumbnail'] = $result['fileName'];
$canUpdate = TRUE;
$isUpload = TRUE;
}
} else {
$canUpdate = TRUE;
}
if ($canUpdate) {
$id = $this->Editor_Box_Item_model->update($id, $data);
if ($isUpload && file_exists(EDITOR_IMAGE_THUMBNAIL_PATH . $originalThumb)) {
unlink(EDITOR_IMAGE_THUMBNAIL_PATH . $originalThumb);
}
$url = base_url() . 'admin_editor/list_box_item';
set_flash_message($this->lang->line('admin.box.updated'));
redirect($url);
}
} else {
$this->layout->title('Edit box item');
$this->layout->view('admin_editor/list_box_item', $data);
}
}
开发者ID:pdkhuong,项目名称:VideoFW,代码行数:45,代码来源:Admin_editor.php
示例15: has_message
?>
help-block"> <i class=" fa fa-exclamation-circle"></i> <span id="usernamefield-message"><?php
echo has_message("usernamefield") ? get_message("usernamefield") : "";
?>
</span></span>
</div>
<hr class="margin-top-0 margin-left-15 margin-right-15">
<div class="margin-bottom-0 form-group form-field-form-group <?php
echo has_error("passwordfield") ? "has-error" : (has_success("passwordfield") ? "has-success" : "");
?>
" id="password-field-form-group">
<div class="input-group">
<span class="input-group-btn">
<button id="password-field-btn" class="form-field-btn btn <?php
echo has_error("passwordfield") ? "btn-danger" : (has_success("passwordfield") ? "btn-success" : "btn-default");
?>
" type="button" onclick="this.form.passwordfield.select();">
<i class="fa fa-key"></i>
<span class="form-field-btn-text "> Password </span>
</button>
</span>
<?php
$password = array('name' => 'passwordfield', 'value' => "", 'class' => 'text-center form-control', 'placeholder' => 'Password');
echo form_password($password);
?>
<span class=" input-group-btn form-field-clear-btn-group" id="password-field-clear-btn-group" >
<button disabled data-target="password" id="password-field-clear-btn" class="form-field-clear-btn btn btn-default" type="button">
<i class="fa fa-times text-danger"></i>
</button>
</span>
开发者ID:shemehs,项目名称:shine19395,代码行数:31,代码来源:content.php
示例16: add_research
private function add_research($user_id)
{
$translator = $this->_translator;
$params = array('details' => FILTER_SANITIZE_STRING);
$inputs = filter_input_array(INPUT_POST, $params);
extract($inputs);
if (!has_error()) {
if ($user_id && $details) {
ResearchCitation::create($user_id, $details);
} else {
add_error($translator->translate("mspr_insufficient_info"));
}
}
}
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:14,代码来源:functions.inc.php
示例17: sync_users
function sync_users($soapclient, $session, $clean = false, $is_conversion = false)
{
$timedate = TimeDate::getInstance();
global $current_user;
$last_sync = '1980-07-09 12:00:00';
$user_id = $soapclient->call('get_user_id', array('session' => $session));
if ($user_id == '-1') {
return false;
}
if (!$clean && file_exists('modules/Sync/config.php')) {
require_once 'modules/Sync/config.php';
if (isset($sync_info['last_syncUsers'])) {
$last_sync = $sync_info['last_syncUsers'];
}
} else {
clean_for_sync('Users');
$clean = true;
}
$start_time = $timedate->nowDb();
$GLOBALS['sugar_config']['disable_team_sanity_check'] = true;
//rrs: bug 27579. This works fine for most installs, but we had a customer in switzerland and the quotes where being
//removed from the users.id = '<GUID>' in the where clause causing the query to fail.
$soapclient->charencoding = false;
$result = $soapclient->call('sync_get_entries', array('session' => $session, 'module_name' => 'Users', 'from_date' => $last_sync, 'to_date' => $start_time, 'offset' => 0, 'max_results' => -99, 'select_fields' => array(), 'query' => "users.id = '{$user_id}'", 'deleted' => 2));
add_to_msg('Retrieve Current User Record<br>', true, true);
if (!has_error($result)) {
//update_progress_bar('records', 55 , 100);
add_to_msg('Retrieved ' . $result['result_count'] . ' current User Record<br>', true, true);
$get_entry_list = get_decoded($result['entry_list']);
//update_progress_bar('records', 65 , 100);
$done = save_altered('Users', $get_entry_list);
//update_progress_bar('records', 100 , 100);
$offset = 0;
while (true) {
$result = $soapclient->call('sync_get_entries', array('session' => $session, 'module_name' => 'Users', 'from_date' => $last_sync, 'to_date' => $start_time, 'offset' => $offset, 'max_results' => 50, 'select_fields' => array('user_name', 'id', 'first_name', 'last_name', 'phone_mobile', 'phone_work', 'employee_status', 'reports_to_id', 'title', 'email1', 'email2', 'deleted', 'status'), 'query' => "users.id != '{$user_id}'", 'deleted' => 2));
if (!has_error($result)) {
//update_progress_bar('records', 55 , 100);
add_to_msg('Retrieved ' . $result['result_count'] . ' Records<br>', true, true);
$get_entry_list = get_decoded($result['entry_list']);
//update_progress_bar('records', 65 , 100);
$done = save_altered('Users', $get_entry_list);
//update_progress_bar('records', 100 , 100);
add_to_msg('Added ' . $done['add'] . ' Records <br>', true, true);
add_to_msg('Modified ' . $done['modify'] . ' Records <br>', true, true);
add_to_msg('Done<br>', true, true);
if ($result['next_offset'] > $result['total_count']) {
break;
} else {
$offset = $result['next_offset'];
}
}
}
//end while
restoreUserPassword($user_id);
require_once 'modules/Sync/config.php';
$sync_info['last_syncUsers'] = $start_time;
add_to_msg('Storing Sync Info<BR>', true, true);
write_array_to_file('sync_info', $sync_info, 'modules/Sync/config.php');
if ($clean) {
//now save the admin account/current user back if it's a clean sync just so we can make sure they still exist
if (empty($current_user->id)) {
//retrieve the admin user
$current_user = BeanFactory::getBean('Users', '1');
}
$temp_user = BeanFactory::getBean('Users');
if (!$temp_user->retrieve($current_user->id)) {
$current_user->new_with_id = true;
$current_user->team_exists = true;
}
unset($current_user->user_preferences);
//rrs: bug - 32739
$current_user->default_team = null;
if (!isset($is_conversion) || $is_conversion == false) {
$current_user->save(false);
}
}
$GLOBALS['sugar_config']['disable_team_sanity_check'] = false;
return true;
}
if ($clean) {
//now save the admin account/current user back if it's a clean sync just so we can make sure they still exist
$temp_user = BeanFactory::getBean('Users');
if (!$temp_user->retrieve($current_user->id)) {
$current_user->new_with_id = true;
$current_user->team_exists = true;
}
unset($current_user->user_preferences);
//rrs: bug - 32739
$current_user->default_team = null;
if (!isset($is_conversion) || $is_conversion == false) {
$current_user->save(false);
}
}
$GLOBALS['sugar_config']['disable_team_sanity_check'] = false;
return false;
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:96,代码来源:SyncHelper.php
示例18: process_mspr_inputs
/**
* adds errors, if found. May modify inputs in the process
* @param string $type
* @param array $inputs May modify inputs in the process
* @param mixed $translator
*/
function process_mspr_inputs($type, array &$inputs, $translator)
{
switch ($type) {
case 'studentships':
if (!($inputs['title'] && $inputs['year'])) {
add_error($translator->translate("mspr_insufficient_info"));
}
break;
case 'clineval':
if (!($inputs['text'] && $inputs['source'])) {
add_error($translator->translate("mspr_insufficient_info"));
}
break;
case 'internal_awards':
if (!($inputs['award_id'] && $inputs['year'])) {
add_error($translator->translate("mspr_insufficient_info"));
}
break;
case 'external_awards':
if (!($inputs['title'] && $inputs['terms'] && $inputs['body'] && $inputs['year'])) {
add_error($translator->translate("mspr_insufficient_info"));
}
break;
case 'contributions':
if (!($inputs['role'] && $inputs['org_event'] && $inputs['start_year'])) {
add_error($translator->translate("mspr_insufficient_info"));
}
break;
case 'student_run_electives':
if (!($inputs['group_name'] && $inputs['university'] && $inputs['location'] && $inputs['start_year'])) {
add_error($translator->translate("mspr_insufficient_info"));
}
break;
case 'observerships':
if (!checkDateFormat($inputs['start'])) {
add_error($translator->translate("mspr_observership_invalid_dates"));
} else {
$parts = date_parse($inputs['start']);
$start_ts = mktime(0, 0, 0, $parts['month'], $parts['day'], $parts['year']);
if ($inputs['end'] && checkDateFormat($inputs['end'])) {
$parts = date_parse($inputs['end']);
$end_ts = mktime(0, 0, 0, $parts['month'], $parts['day'], $parts['year']);
} else {
$end_ts = null;
}
$inputs['start'] = $start_ts;
$inputs['end'] = $end_ts;
}
if (!$inputs['preceptor_proxy_id']) {
$inputs['preceptor_proxy_id'] = null;
}
if (!$inputs['preceptor_proxy_id'] && !($inputs['preceptor_firstname'] || $inputs['preceptor_lastname'])) {
add_error($translator->translate("mspr_observership_preceptor_required"));
}
if ($inputs['preceptor_proxy_id'] == -1) {
//special case for "Various"
$inputs['preceptor_proxy_id'] = 0;
//not faculty
$inputs['preceptor_firstname'] = "Various";
$inputs['preceptor_lastname'] = "";
}
if (!has_error() && !($inputs['title'] && $inputs['site'] && $inputs['location'] && $inputs['start'])) {
add_error($translator->translate("mspr_insufficient_info"));
}
break;
case 'int_acts':
if (!checkDateFormat($inputs['start'])) {
add_error($translator->translate("mspr_observership_invalid_dates"));
} else {
if (!$inputs['end'] || !checkDateFormat($inputs['end'])) {
$inputs['end'] = $inputs['start'];
}
}
if (!has_error() && !($inputs['title'] && $inputs['site'] && $inputs['location'] && $inputs['start'])) {
add_error($translator->translate("mspr_insufficient_info"));
}
break;
case 'critical_enquiry':
case 'community_based_project':
if (!($inputs['title'] && $inputs['organization'] && $inputs['location'] && $inputs['supervisor'])) {
add_error($translator->translate("mspr_insufficient_info"));
}
break;
case 'research_citations':
if (!$inputs['details'] && !is_array($inputs['research_citations'])) {
add_error($translator->translate("mspr_insufficient_info"));
}
break;
}
}
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:96,代码来源:functions.inc.php
|
请发表评论