本文整理汇总了PHP中success函数的典型用法代码示例。如果您正苦于以下问题:PHP success函数的具体用法?PHP success怎么用?PHP success使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了success函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: edit
public function edit()
{
// 对herstellername 进行update 首先判断是不是点击了post那个按钮
// 1、 显示没点击按钮的时候,如果是没点击按钮 那么通过segment(3) 来通过
// 与结果比对 如果是 那么selected 否则正常显示
// 2、 如果点击了按钮的时候
// ----先要对所进行update的herstellername进行筛选,如果确定是唯一的名字那么
// 是可以更新 否则不能更新
if ($this->input->post("update")) {
$fzh_id = $this->uri->segment(3);
$fzhg_id = $this->input->post('fzhg_id');
$land_id = $this->input->post("land_id");
$herstellername = $this->input->post("herstellername");
$array = array("herstellername" => $herstellername);
if (!count($this->hst->h_existiert($array))) {
$array = array("fzhg_id" => $fzhg_id, "land_id" => $land_id, "herstellername" => $herstellername);
$index = $this->hst->h_insert($array)[0]["fzh_id"];
success("hersteller/index/{$index}", "Add Hersteller Success!!");
} else {
error("Die hersteller Name schon existiert!!!update fehler!!");
}
// p($_POST);die;
} else {
$fzh_id = $this->uri->segment(3);
$array = array('fzh_id' => $fzh_id);
$data['result'] = $this->hst->hbindung_s($array);
$data['land'] = $this->land->l_select();
$data['gruppename'] = $this->hstg->hg_select();
// p($data);die;
$this->load->view("hersteller/edit", $data);
}
}
开发者ID:arnold1119,项目名称:Hiwi_FasDB,代码行数:32,代码来源:hersteller.php
示例2: reply_insert
/**
* 回复动作
*/
public function reply_insert()
{
$data = array('pid' => $this->input->post('mid'), 'time' => time(), 'content' => $this->input->post('content'));
$this->message->insert($data);
success('admin/message/index', '操作成功');
// print_r($data);
}
开发者ID:qcdcool,项目名称:book-1,代码行数:10,代码来源:message.php
示例3: testSaveState
/**
* @depends testReadState
* @group Database
*/
public function testSaveState()
{
info("\tTesting state-save\n");
$token = str_shuffle("ABCDEF123456789");
$params = array("cmd" => "write", "data" => '[{"name":"test-case-setting","value":"TEST_CASE_' . $token . '"}]', "id" => 1, "session" => "session", "user" => "user");
$paramHolder = new AgaviRequestDataHolder();
$paramHolder->setParameters($params);
$controller = AgaviContext::getInstance()->getController();
$container = $controller->createExecutionContainer("AppKit", "Ext.ApplicationState", $paramHolder, "javascript", "write");
try {
$result = $container->execute();
$data = json_decode($result->getContent(), true);
} catch (Exception $e) {
$this->fail("An exception was thrown during state write: " . $e->getMessage());
}
// Check for success state
if (@(!$data["success"])) {
$this->fail("Could not write view state! Your cronk settings may not be saved in icinga-web.");
}
// Finally get sure the enry is really set
$entryFound = false;
foreach ($data["data"] as $entry) {
if ($entry["name"] == 'test-case-setting' && $entry["value"] == 'TEST_CASE_' . $token) {
$entryFound = true;
}
}
if (!$entryFound) {
$this->fail("Write returned success, but preference could not be found in DB!\n");
}
success("\tWriting state succeeded!\n");
}
开发者ID:philippjenni,项目名称:icinga-web,代码行数:35,代码来源:persistenceView.php
示例4: createGuild
public function createGuild($name, $character)
{
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$player = new OTS_Player();
$player->load($character);
$new_guild = new OTS_Guild();
$new_guild->setCreationData(time());
$new_guild->setName($name);
$new_guild->setOwner($player);
$new_guild->save();
$new_guild->setCustomField('motd', 'New guild. Leader must edit this text :)');
$new_guild->setCustomField('creationdata', time());
$new_guild->setCustomField('world_id', $player->getWorld());
$ranks = $new_guild->getGuildRanksList();
$ranks->orderBy('level', POT::ORDER_DESC);
foreach ($ranks as $rank) {
if ($rank->getLevel() == 3) {
$player->setRank($rank);
$player->save();
}
}
$ide = new IDE();
$ide->redirect(WEBSITE . "/index.php/guilds/view/" . $new_guild->getId());
success("{$name} has been created.");
}
开发者ID:Alexy234,项目名称:modernaac,代码行数:26,代码来源:guilds_model.php
示例5: showxml
function showxml($result, $num_rows)
{
if ($num_rows > 0) {
echo "<node>";
while ($row = mysql_fetch_array($result)) {
$staff_id = $row['staff_id'];
$staff_name = "";
$sub_result = mysql_query("SELECT firstname,lastname FROM isost_staff where staff_id={$staff_id}");
$sub_row = mysql_fetch_array($sub_result);
$staff_name = $sub_row['firstname'] . " " . $sub_row['lastname'];
echo "<ticket>";
echo "<tid>" . $row['ticket_id'] . "</tid>";
echo "<dept_id>" . $row['dept_id'] . "</dept_id>";
echo "<topic_id>" . $row['topic_id'] . "</topic_id>";
echo "<priority_id>" . $row['priority_id'] . "</priority_id>";
echo "<staff>" . $staff_name . "</staff>";
echo "<email>" . $row['email'] . "</email>";
echo "<name>" . $row['name'] . "</name>";
echo "<subject><![CDATA[" . $row['subject'] . "]]></subject>";
echo "<helptopic>" . $row['helptopic'] . "</helptopic>";
echo "<status>" . $row['status'] . "</status>";
echo "<source>" . $row['source'] . "</source>";
echo "<duedate>" . $row['duedate'] . "</duedate>";
echo "<created>" . $row['created'] . "</created>";
echo "<updated>" . $row['updated'] . "</updated>";
echo "<isoverdue>" . $row['isoverdue'] . "</isoverdue>";
echo "<ip_address>" . $row['ip_address'] . "</ip_address>";
echo "</ticket>";
}
echo "</node>";
} else {
$nodata = 0;
success($nodata);
}
}
开发者ID:kumarsivarajan,项目名称:ctrl-dock,代码行数:35,代码来源:tkt_list_by_states.php
示例6: save_permission
public function save_permission()
{
$response = array();
$this->load->model('cpanel/groups_model');
$this->load->model('dx_auth/permissions');
if ($this->input->post('group_id', true)) {
if ($this->input->post('resources', true)) {
$group_id = (int) $this->input->post('group_id', true);
$resources = $this->groups_model->get_all_resources();
$access = $this->input->post('resources', true);
if (count($access) > 0) {
$r_resources = array();
foreach ((array) $resources as $val) {
$allow = in_array($val['id'], $access) ? true : false;
$r_resources[$val['name']] = $allow;
}
$save = $this->permissions->set_permission_data($group_id, $r_resources);
if ($save) {
$response['status'] = 1;
$response['msg'] = success("Data permission berhasil disimpan");
} else {
$response['status'] = 0;
$response['msg'] = error("Data permission gagal disimpan");
}
}
} else {
$response['status'] = 0;
$response['msg'] = "Silahkan pilih resources";
}
} else {
$response['status'] = 0;
$response['msg'] = "Silahkan pilih resources";
}
$this->output->set_content_type('application/json')->set_output(json_encode($response));
}
开发者ID:unregister,项目名称:tutupgelas,代码行数:35,代码来源:groups.php
示例7: checkLogin
/**
* 检查登录是否成功
*
* @date 2015-10-09
* @return [type] [description]
*/
public function checkLogin()
{
if (!Request::has('username', 'password')) {
return failure('请输入用户名或密码');
}
// $rules = [
// 'captcha' => 'required|captcha',
// ];
// $validator = Validator::make(Request::all(), $rules);
// if ($validator->fails()) {
// return $this->failure('验证码错误');
// }
$admin = Admin::where('username', Request::input('username'))->first();
if (!$admin) {
return failure('用户不存在');
}
if (!Hash::check(Request::input('password'), $admin->password)) {
return failure('用户名或密码错误');
}
$admin->increment('sign_in_cnt');
$admin->last_sign_in_at = Carbon::now();
$admin->last_sign_in_ip = Request::getClientIp();
$admin->save();
Auth::loginUsingId($admin->user_id);
return success('登录成功');
}
开发者ID:jiujiubaba,项目名称:laravel,代码行数:32,代码来源:AuthController.php
示例8: addmarks
public function addmarks()
{
// 基本接收的内容
$targetfile = $this->ExcelMethod('Excel');
$examname = $this->input->post('examname');
$bz = $this->input->post('bz');
$belong = $this->input->post('belong');
$period = $this->input->post('period');
// 获取第一个工作空间obj对象
$obj = $this->getExcelObject($targetfile, 1);
// 校验Excel是否符合要求最基本的:学号 成绩
$arr = array('学号', '成绩');
$boool = $this->IsokFirstcolum($obj[0], $arr);
// 符合要求Excel对象
if ($boool) {
// 进行对excel对象进行处理 user_name
$mm = $this->DoMarkData($obj, $boool, "学号");
$exam = $this->DoMarkData($obj, $boool, "成绩");
// 进行对号入座的匹配
$data = $this->MarkManager->getStuInfos($belong, $period);
// 合成的对象
$comdata = $this->iSpecialData($mm, $exam, $data);
if (!count($comdata)) {
success('MarkManager/importMarkinfo?belong=' . $belong . '&period=' . $period, '你导入的Excel不符合要求');
}
// 进行合格 与 不合格的操作
$alldata = $this->getMarkDataInfo($comdata);
$finaldata = array('belong' => $belong, 'period' => $period, 'title' => $examname, 'schoolzone' => $data[0]['school_zone'], 'personcount' => count($data), 'inportmarkTime' => date("Y-m-d H:i:s", time()), 'markBz' => $bz, 'markcomment' => $alldata['average'], 'markInfo' => json_encode($comdata), 'passcount' => count($alldata['pass']), 'nopasscount' => count($alldata['nopass']), 'nopassinfo' => json_encode($alldata['nopass']), 'passinfo' => json_encode($alldata['pass']), 'passpercernt' => count($alldata['pass']) / count($comdata));
// 插入数据操作
$this->MarkManager->insertaddmarksData($finaldata);
$this->markInfo();
} else {
success('MarkManager/importMarkinfo?belong=' . $belong . '&period=' . $period, '你导入的Excel不符合要求');
}
}
开发者ID:ZuoYouLai,项目名称:DX_Project,代码行数:35,代码来源:MarkManager.php
示例9: update_manual
function update_manual($argv)
{
$start = time();
$manual_path = $argv[0];
$api_url = "http://{$argv[1]}/api";
$chapter_url_root = "{$api_url}/view/";
$tpl = file_get_contents("{$manual_path}/public/book.tpl");
$init = json_decode(make_request($api_url), 1);
$init = $init['data'];
foreach ($init as $i => $value) {
if (!$value['_child']) {
build_chapter($manual_path, $chapter_url_root, $value['id'], $i . '.' . $value['title'], $value['title'], '');
} else {
$parent_dir = $i . '.' . $value['title'];
substr(PHP_OS, 0, 3) == 'WIN' ? $parent_dir = iconv('UTF-8', 'GB2312', $parent_dir) : '';
if (!is_dir("{$manual_path}/{$parent_dir}")) {
$flag = mkdir("{$manual_path}/{$parent_dir}");
}
foreach ($value['_child'] as $j => $child) {
build_chapter($manual_path, $chapter_url_root, $child['id'], "{$i}.{$j} {$child['title']}", $child['title'], $parent_dir);
}
}
}
$time = time() - $start;
success("the manual has been generated,it takes {$time} s");
}
开发者ID:262877348,项目名称:Sublime-Text,代码行数:26,代码来源:command.php
示例10: insert
public function insert()
{
$content = $this->input->post('content');
$data = array('content' => $content, 'time' => time(), 'uid' => 0);
$this->message->insert($data);
success('index/message/index', '添加成功');
}
开发者ID:qcdcool,项目名称:book-1,代码行数:7,代码来源:message.php
示例11: showxml
function showxml($result, $num_rows, $query, $status)
{
if ($num_rows > 0) {
$noofopentickets = 0;
$noofclosedtickets = 0;
$noofslabreached = 0;
$nooftransfered = 0;
echo "<node>";
while ($row = mysql_fetch_array($result)) {
$staffid = $row[0];
if (strlen($status) > 0) {
if ($status == 'open') {
$sql1 = mysql_query("select count(t.ticket_id) from isost_ticket t where t.status='{$status}' and t.staff_id='{$staffid}' {$query}");
$row1 = mysql_fetch_row($sql1);
$noofopentickets = $row1[0];
$sql2 = mysql_query("select count(t.ticket_id) from isost_ticket t where t.isoverdue=1 and t.status='{$status}' and t.staff_id='{$staffid}' {$query}");
$row2 = mysql_fetch_row($sql2);
$noofslabreached = $row2[0];
}
if ($status == 'transfered') {
$sql3 = mysql_query("select count(t.ticket_id) from isost_ticket t inner join isost_ticket_note tn on t.ticket_id=tn.ticket_id where t.status='open' and tn.title like 'Dept. Transfer %' and tn.staff_id='{$staffid}' {$query}");
$row3 = mysql_fetch_row($sql3);
$nooftransfered = $row3[0];
$noofopentickets = $row3[0];
}
if ($status == 'closed') {
$sql4 = mysql_query("select count(t.ticket_id) from isost_ticket t where t.status='{$status}' and t.staff_id='{$staffid}' {$query}");
$row4 = mysql_fetch_row($sql4);
$noofclosedtickets = $row4[0];
}
} else {
$sql1 = mysql_query("select count(t.ticket_id) from isost_ticket t where t.status='open' and t.staff_id='{$staffid}' {$query}");
$row1 = mysql_fetch_row($sql1);
$noofopentickets = $row1[0];
$sql2 = mysql_query("select count(t.ticket_id) from isost_ticket t where t.isoverdue=1 and t.status='open' and t.staff_id='{$staffid}' {$query}");
$row2 = mysql_fetch_row($sql2);
$noofslabreached = $row2[0];
$sql3 = mysql_query("select count(t.ticket_id) from isost_ticket t inner join isost_ticket_note tn on t.ticket_id=tn.ticket_id where t.status='open' and tn.title like 'Dept. Transfer %' and tn.staff_id='{$staffid}' {$query}");
$row3 = mysql_fetch_row($sql3);
$nooftransfered = $row3[0];
$sql4 = mysql_query("select count(t.ticket_id) from isost_ticket t where t.status='closed' and t.staff_id='{$staffid}' {$query}");
$row4 = mysql_fetch_row($sql4);
$noofclosedtickets = $row4[0];
}
echo "<staff>";
echo "<staffid>" . $staffid . "</staffid>";
echo "<firstname>" . $row[1] . "</firstname>";
echo "<lastname>" . $row[2] . "</lastname>";
echo "<openticket>" . $noofopentickets . "</openticket>";
echo "<closedticket>" . $noofclosedtickets . "</closedticket>";
echo "<transferedticket>" . $nooftransfered . "</transferedticket>";
echo "<slabreached>" . $noofslabreached . "</slabreached>";
echo "</staff>";
}
echo "</node>";
} else {
$nodata = 0;
success($nodata);
}
}
开发者ID:kumarsivarajan,项目名称:ctrl-dock,代码行数:60,代码来源:listengineer.php
示例12: success_and_failure
/**
* Prints the WordPress-standard success and/or failure bar when a message is stored
* in either of success() or failure().
*/
function success_and_failure()
{
foreach (array('success' => success(), 'failure' => failure()) as $class => $message) {
if (is_admin() && $message) {
?>
<div class="updated fade <?php
echo $class;
?>
" id="message" style="background-color: <?php
$class == 'success' ? 'rgb(255, 251, 204)' : '#AB6F74';
?>
;">
<p><?php
echo $message;
?>
</p></div><br />
<?php
} else {
if ($message) {
?>
<div class="<?php
echo $class;
?>
">
<p><?php
echo $message;
?>
</p>
</div>
<?php
}
}
}
}
开发者ID:asalce,项目名称:wp-ci,代码行数:38,代码来源:wpci_helper.php
示例13: add
function add()
{
$this->system->add_breadcrumb('Data resources', '_cpanel/admin/resources/data');
$this->system->add_breadcrumb('Tambah resources');
if (isset($_POST['save_resources'])) {
$name = trim($_POST['name']);
if ($name == '') {
$data['msg'] = error("Resources name is required");
} else {
$is_available = $this->adodb->GetOne("SELECT COUNT(*) FROM sys_resources WHERE `name` = '{$name}'");
if ($is_available > 0) {
$data['msg'] = error("Resources for \"{$name}\" is available on DB. Please use another name");
} else {
$parent_id = (int) $_POST['parent_id'];
$insert = $this->adodb->Execute("INSERT INTO sys_resources SET parent_id = '{$parent_id}',`name` = '{$name}'");
if ($insert) {
$data['msg'] = success("New resources has been saved successfully");
}
}
}
}
$data['resources'] = array_resources();
$data['module'] = "_cpanel";
$data['page'] = "layout_add_resources";
$this->load->view($this->layout_content, $data);
}
开发者ID:unregister,项目名称:tutupgelas,代码行数:26,代码来源:resources.php
示例14: speicher
public function speicher()
{
$data = $this->input->post();
// p($data);die;
$fahrzeug['fzh_id'] = $data['fzh_id'];
$fahrzeug['fahrzeugname'] = trim($data['fahrzeugname']);
// var $array = array(
// "fahrzeugname" => $fahrzeug['fahrzeugname'],
// );
// $$this->fahrzeug->exit_id($array);
$fahrzeug['fzk_id'] = $data['fzk_id'];
$fahrzeug['baujahr'] = $data['baujahr'];
$fahrzeug['aenderung'] = $data['aenderung'];
$fahrzeug['eingabe'] = $data['eingabe'];
$flag = preg_match('/^\\d\\d\\d\\d$/is', $fahrzeug['baujahr']);
if ($fahrzeug) {
if ($flag) {
$fz_id = $this->fahrzeug->add($fahrzeug);
$markt['fz_id'] = $fz_id;
$markt['markt_id'] = $data['markt_id'];
$this->land->m_array_insert($markt);
$quelle['fz_id'] = $fz_id;
$quelle['quelle_id'] = $data['quelle_id'];
$this->quelle->array_insert($quelle);
$fas['fz_id'] = $fz_id;
$fas['fas_id'] = $data['fas_id'];
$this->fas->array_insert($fas);
success("fahrzeug/fzginfo/{$fz_id}", "Date update success");
} else {
error("Bitte eine richtig formig Baujahr eingaben!Z.B 2016");
}
}
}
开发者ID:arnold1119,项目名称:Hiwi_FasDB,代码行数:33,代码来源:fahrzeug.php
示例15: showxml
function showxml($result, $num_rows, $agency)
{
if ($num_rows > 0) {
echo "<node>";
while ($row = mysql_fetch_array($result)) {
$pass = encryptpass($row[3]);
$sasql = "select * from ops_user_group where group_id='1' and username='{$row['5']}'";
$saresult = mysql_query($sasql);
$sacount = mysql_num_rows($saresult);
$superadmin = 0;
if ($sacount > 0) {
$superadmin = 1;
}
$sasql = "SELECT * from agency_manager where (prim_manager='{$row['5']}' or sec_manager='{$row['5']}') and agency_index='{$agency}'";
$saresult = mysql_query($sasql);
$sacount = mysql_num_rows($saresult);
if ($superadmin == 0 && $sacount > 0) {
$superadmin = 1;
}
echo "<user>";
echo "<first_name>" . $row[0] . "</first_name>";
echo "<last_name>" . $row[1] . "</last_name>";
echo "<email>" . $row[2] . "</email>";
echo "<pass>" . $pass . "</pass>";
echo "<expiry>" . $row[4] . "</expiry>";
echo "<username>" . $row[5] . "</username>";
echo "<superadmin>" . $superadmin . "</superadmin>";
echo "</user>";
}
echo "</node>";
} else {
$nodata = 0;
success($nodata);
}
}
开发者ID:kumarsivarajan,项目名称:ctrl-dock,代码行数:35,代码来源:rim_access.php
示例16: delete
function delete()
{
$id = $_REQUEST['id'];
$query = "DELETE FROM customers WHERE id={$id}";
mysql_query($query) or fail(mysql_error());
success('delete successful');
}
开发者ID:AmidoriA,项目名称:poon-project,代码行数:7,代码来源:services.php
示例17: save_inquiry
public function save_inquiry()
{
if (isset($_POST['inquiry_send'])) {
$this->load->library('form_validation');
$this->form_validation->set_rules('inquiry_name', 'Nama', 'trim|required|xss_clean');
$this->form_validation->set_rules('inquiry_phone', 'No telepon', 'trim|required|xss_clean');
$this->form_validation->set_rules('inquiry_location', 'Lokasi', 'trim|required|xss_clean');
$this->form_validation->set_rules('inquiry_captcha', 'Security code', 'trim|required|xss_clean|captcha_check');
if ($this->form_validation->run() === FALSE) {
$msg = error(validation_errors());
set_msg($msg);
redirect(_URL);
exit;
} else {
$this->db->set('inquiry_name', $this->input->post('inquiry_name'));
$this->db->set('inquiry_phone', $this->input->post('inquiry_phone'));
$this->db->set('inquiry_location', $this->input->post('inquiry_location'));
$this->db->set('inquiry_services', ucfirst($this->input->post('inquiry_services')));
$this->db->set('inquiry_message', $this->input->post('inquiry_message'));
$this->db->set('inquiry_created', 'NOW()', FALSE);
$insert = $this->db->insert('inquiry');
if ($insert) {
$msg = success("Terimakasih. Inquiry berhasil disimpan");
} else {
$msg = success("Inquiry gagal disimpan. Silahkan ulangi");
}
set_msg($msg);
redirect(_URL);
exit;
}
}
}
开发者ID:unregister,项目名称:tutupgelas,代码行数:32,代码来源:home.php
示例18: sendFormAction
function sendFormAction()
{
if (empty($_POST['bID'])) {
return error(t('Invalid form submission (missing bID)'));
} else {
$block = Block::getByID($_POST['bID']);
$blockController = new FormController($block);
$blockController->noSubmitFormRedirect = true;
$redirectURL = '';
// //Handle redirect-on-success...
if ($blockController->redirectCID > 0) {
$redirectPage = Page::getByID($blockController->redirectCID);
if ($redirectPage->cID) {
$redirectURL = Loader::helper('navigation')->getLinkToCollection($redirectPage, true);
}
}
$blockController->redirectCID = 0;
//reset this in block controller, otherwise it will exit before returning the data we need!
try {
$success = $blockController->action_submit_form($_POST['bID']);
if ($success != null && $success == false) {
return error(t('Invalid form submission (invalid block ids)'));
}
} catch (Exception $e) {
return error($e->getMessage());
}
$fieldErrors = $blockController->get('errors');
if (is_array($fieldErrors)) {
foreach ($fieldErrors as $key => $value) {
return error($fieldErrors[$key]);
}
}
return success($blockController->thankyouMsg);
}
}
开发者ID:76interactive,项目名称:c5_ajax_form,代码行数:35,代码来源:responder.php
示例19: parse
public function parse($orig_name)
{
global $CORE;
ob_start();
if (is_action()) {
try {
$name = post('name');
if (!$name) {
throw new FieldInputError('name', l('Please provide a map name.'));
}
if (!preg_match(MATCH_MAP_NAME, $name)) {
throw new FieldInputError('name', l('This is not a valid map name (need to match [M])', array('M' => MATCH_MAP_NAME)));
}
if (count($CORE->getAvailableMaps('/^' . $name . '$/')) > 0) {
throw new FieldInputError('name', l('A map with this name already exists.'));
}
// Read the old config
$MAPCFG = new GlobalMapCfg($orig_name);
$MAPCFG->readMapConfig();
// Create a new map config
$NEW = new GlobalMapCfg($name);
$NEW->createMapConfig();
foreach ($MAPCFG->getMapObjects() as $object_id => $cfg) {
$NEW->addElement($cfg['type'], $cfg, $perm = true, $object_id);
}
success(l('The map has been created.'));
reload(cfg('paths', 'htmlbase') . '/frontend/nagvis-js/index.php?mod=Map&show=' . $name, 1);
} catch (FieldInputError $e) {
form_error($e->field, $e->msg);
} catch (NagVisException $e) {
form_error(null, $e->message());
} catch (Exception $e) {
if (isset($e->msg)) {
form_error(null, $e->msg);
} else {
throw $e;
}
}
}
echo $this->error;
echo '<div class="simple_form">' . N;
js_form_start('to_new_map');
input('name');
submit(l('Save'));
focus('name');
// Keep the view parameters the users has set
$params = ltrim(req('view_params'), '&');
if ($params) {
$parts = explode('&', $params);
foreach ($parts as $part) {
list($key, $val) = explode('=', $part);
hidden($key, $val);
}
}
form_end();
echo '</div>' . N;
return ob_get_clean();
}
开发者ID:rlugojr,项目名称:nagvis,代码行数:58,代码来源:ViewToNewMap.php
示例20: init
function init($args)
{
$name = $args['name'];
$location = $args['location'];
//check if album already exists
$cp = new ConfigReader(PF_CONFIG_FILE);
$albums = $cp->getChildren("settings/albums");
if ($albums) {
foreach ($albums as $album) {
if ($album['attributes']['name'] == $name) {
error("Album {$name} already exists!");
return;
}
}
}
define("ALBUM_DIR", realpath($_SERVER['DOCUMENT_ROOT'] . '/' . $location));
//check if it exists
if (!is_dir(ALBUM_DIR)) {
error("It seems like the directory {$location} does not exist.");
return;
}
//check if directory writeable
if (!is_writeable(ALBUM_DIR)) {
error("Could not create album. Could not write to {$location}." . ALBUM_DIR);
return;
}
//get a list of photos (jpg/png)
//generate thumbnails
chdir(ALBUM_DIR);
//try to make thumbnail directory
if (!is_dir(PF_THUMBNAIL_DIR)) {
if (!mkdir(PF_THUMBNAIL_DIR)) {
error("Could not create thumbnails directory in {$location}");
return;
}
}
//generate thumbnails
//it seems glob cannot take multiple patterns
$pattern = array("*.jpg", "*.jpeg", "*.png");
foreach ($pattern as $pat) {
foreach (glob($pat) as $file) {
if (!makeThumbnail($file, PF_THUMBNAIL_DIR . $file)) {
error("Could not create thumbnail for image {$file}");
return;
}
}
}
//add album to config file
$cp = new ConfigWriter(PF_CONFIG_FILE);
$attributes = array("name" => $name, "location" => str_replace($_SERVER['DOCUMENT_ROOT'], "", ALBUM_DIR), "theme" => PF_DEFAULT_THEME);
$cp->addWithAttributes('settings/albums/album', $attributes, "");
if (!$cp->close()) {
error("Could not write to configuration file");
}
success("Successfully created album {$name} in {$location}.");
}
开发者ID:nikhilm,项目名称:pixelframe,代码行数:56,代码来源:pf_add_album.php
注:本文中的success函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论