function process() { global $current_user, $timedate, $app_list_strings, $current_language, $mod_strings; $mod_strings = return_module_language($current_language, 'ProductComponents'); $format = new Format(); parent::process(); if ($this->viaAJAX) { // override for ajax call $this->ss->assign('saveOnclick', "onclick='if(check_form(\"productComponentsQuickCreate\")) return SUGAR.subpanelUtils.inlineSave(this.form.id, \"productcomponents\"); else return false;'"); $this->ss->assign('cancelOnclick', "onclick='return SUGAR.subpanelUtils.cancelCreate(\"subpanel_productcomponents\")';"); } $this->ss->assign('viaAJAX', $this->viaAJAX); $this->javascript = new javascript(); $this->javascript->setFormName('productComponentsQuickCreate'); $focus = new ProductComponents(); $this->javascript->setSugarBean($focus); $this->javascript->addAllFields(''); $app_list_strings['products_format_options'] = $format->Get_Dropdown_Data(); $this->ss->assign('additionalScripts', $this->javascript->getScript(false)); $this->ss->assign('run_style_options', get_select_options_with_id($app_list_strings['layout_type_options'], '')); $this->ss->assign('type_options', get_select_options_with_id($app_list_strings['type_options'], $focus->type)); $this->ss->assign('color_side_a', get_select_options_with_id($app_list_strings['color_side_a'], $focus->color_side_a)); $this->ss->assign('color_side_b', get_select_options_with_id($app_list_strings['color_side_b'], $focus->color_side_b)); $this->ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['project_task_status_options'], $focus->status)); $this->ss->assign("FORMAT_OPTIONS", get_select_options_with_id($app_list_strings['products_format_options'], $focus->format)); $this->ss->assign("RUN_FORMAT_OPTIONS", get_select_options_with_id($app_list_strings['products_format_options'], $focus->format)); $this->ss->assign("BLEED_FORMAT_OPTIONS", get_select_options_with_id($app_list_strings['products_format_options'], $focus->format)); $ppref = 'PRD'; $pnumber = $focus->get_pnum(); $number_suf = $focus->generate_number(); $this->ss->assign('number_pref', $ppref); $this->ss->assign('pnum', $pnumber); $this->ss->assign('number_suf', $number_suf); $this->ss->assign("LAYOUTROWS", $focus->getLayoutRow(new Layoutline(), 0, true, true)); //$this->ss->parse("main.row1"); $json = getJSONobj(); /////////////////////////////////////// /// /// SETUP PARENT POPUP $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'projectTypeQuickCreate', 'field_to_name_array' => array('id' => 'parent_id', 'name' => 'parent_name')); $encoded_parent_popup_request_data = $json->encode($popup_request_data); $this->ss->assign('encoded_parent_popup_request_data', $encoded_parent_popup_request_data); $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'productComponentsQuickCreate', 'field_to_name_array' => array('id' => 'paperid', 'pname' => 'paper')); $this->ss->assign('encoded_paper_popup_request_data', $json->encode($popup_request_data)); //machines popup /* $popup_request_data = array( 'call_back_function' => 'set_return', 'form_name' => 'productComponentsQuickCreate', 'field_to_name_array' => array( 'id' => 'machine_id', 'name' => 'machine', ), ); $encoded_popup_request_data = $json->encode($popup_request_data); $this->ss->assign('encoded_machine_popup_request_data', $encoded_popup_request_data); */ }
/** * @covers \Tivie\GitLogParser\Format::setFormat * @covers \Tivie\GitLogParser\Format::getFormatString * @covers \Tivie\GitLogParser\Format::getCommitDelimiter * @covers \Tivie\GitLogParser\Format::getFieldDelimiter */ public function testSetGetFormat() { $format = new Format(); $cDel = '<br>'; $fDel = '|'; $formatStr = "%h{$fDel}%d{$fDel}%B{$cDel}"; $format->setFormat($formatStr, $cDel, $fDel); self::assertEquals($cDel, $format->getCommitDelimiter()); self::assertEquals($fDel, $format->getFieldDelimiter()); self::assertEquals($formatStr, $format->getFormatString()); }
public function action_add_blocked($block = null) { if (empty($block) === true) { $block = $_POST['blocked']; } else { $block = str_replace('-', '.', $block); } $blacklist_item = Model_Blacklist::query()->where('expression', $block)->get_one(); if (empty($blacklist_item) === true) { $blacklist_item = Model_Blacklist::forge(array('expression' => $block)); $blacklist_item->save(); if (Input::is_ajax() === true) { echo $blacklist_item->id; } } else { if (Input::is_ajax() === true) { print_r(Format::forge(array('error' => 'Already Exists'))->to_json()); } else { Session::set('error', $block . ' is already in the blacklist!'); } } if (Input::is_ajax() === true) { die; } Response::Redirect_Back(); }
function init_formatting() { // if ($this->variable == 'title') { // $this->span_class = 'title'; // } parent::init_formatting(); }
/** * Execute the job. * * @return void */ public function handle() { try { //dd($this->req); \DB::begintransaction(); $me = \Me::data()->id_karyawan; // Create PO $po = data_po::create(['id_sph' => $this->req['id'], 'id_vendor' => $this->req['vendor'], 'deadline' => $this->req['deadline'], 'id_pembuat' => $me, 'id_acc' => 0, 'adjustment' => $this->req['adjustment'], 'diskon' => $this->req['gdiskon'], 'ppn' => $this->req['gppn'], 'keterangan' => $this->req['ket'], 'titipan' => $this->req['titipan']]); foreach ($this->req['id_barang'] as $i => $id_barang) { data_po_item::create(['id_po' => $po->id_po, 'id_item' => $id_barang, 'req_qty' => $this->req['qty'][$i], 'qty' => $this->req['qty'][$i], 'harga' => $this->req['harga'][$i], 'diskon' => $this->req['diskon'][$i], 'keterangan' => $this->req['kets'][$i], 'id_satuan' => $this->req['satuan'][$i], 'id_prq' => $this->req['id_prq'][$i]]); data_prq::find($this->req['id_prq'][$i])->update(['status' => 2]); // update Harga data_barang::find($id_barang)->update(['harga_beli' => $this->req['harga'][$i]]); // Update Log harga data_harga::create(['id_barang' => $id_barang, 'harga' => $this->req['harga'][$i], 'keterangan' => 'Update berdasarkan PO', 'id_po' => $po->id_po, 'id_karyawan' => $me, 'tipe' => 1]); data_prq_item::find($this->req['id_prq_item'][$i])->update(['status' => 2]); } $format = 'PO-'; $po->no_po = $format . \Format::code($po->id_po); $po->save(); \Loguser::create('Membuat PO dengan No. PO ' . $po->no_po); \DB::commit(); return ['result' => true, 'err' => 'PO berhasil dibuat dengan No. ' . $po->no_po]; } catch (\Exception $e) { \DB::rollback(); return ['result' => false, 'err' => $e->getMessage()]; } }
public function filter_comment_content_out($content, $comment) { if ($this->should_pee('C-' . $comment->typename)) { $content = Format::autop($content); } return $content; }
/** * A validation function that returns an error if the value passed in is not a valid URL. * * @param string $text A string to test if it is a valid URL * @param FormControl $control The control that defines the value * @param FormContainer $form The container that holds the control * @param string $warning An optional error message * @return array An empty array if the string is a valid URL, or an array with strings describing the errors */ public static function validate_url($text, $control, $form, $warning = null, $schemes = array('http', 'https'), $guess = true) { if (!empty($text)) { $parsed = InputFilter::parse_url($text); if ($parsed['is_relative']) { if ($guess) { // guess if they meant to use an absolute link $parsed = InputFilter::parse_url('http://' . $text); if ($parsed['is_error']) { // disallow relative URLs $warning = empty($warning) ? _t('Relative urls are not allowed') : $warning; return array($warning); } else { $warning = empty($warning) ? _t('Relative urls are not allowed') : $warning; return array($warning); } } } if ($parsed['is_pseudo'] || !in_array($parsed['scheme'], $schemes)) { // allow only http(s) URLs $warning = empty($warning) ? _t('Only %s urls are allowed', array(Format::and_list($schemes))) : $warning; return array($warning); } } return array(); }
public static function add_user_play($username, $password, $artist, $album, $title, $length) { // ensure we have the length in milliseconds. $length = Format::fix_length($length); if ($length === -1) { Logger::log("add_play: failed to convert length to milliseconds"); return false; } // unknown artist/album ("") becomes "N/A" if ($artist === "") { $artist = "N/A"; } if ($album === "") { $album = "N/A"; } $db = Database::instance(); $sql = 'SELECT api_add_user_play(?, ?, ?, ?, ?, ?) AS success'; $params = array($username, $password, $artist, $album, $title, $length); try { $rows = $db->select($sql, $params); } catch (Exception $e) { Logger::log("add_user_play: database failure: " . $e->getMessage()); return false; } return count($rows) === 1 && $rows[0]['success'] === true; }
public function getDatapembelian(Request $req) { if ($req->ajax()) { $res = []; $out = ''; $kat = []; $seri = []; $items = data_po::grafikpembelian($req->tahun)->get(); foreach ($items as $item) { $kat[] = \Format::indoDate2($item->tanggal); $seri[] = (int) $item->total; } $res['po'] = ['kategori' => $kat, 'data' => $seri]; $kato = []; $serio = []; $obats = data_po_item::grafikpembelian(1, $req->tahun)->get(); foreach ($obats as $o) { $kato[] = \Format::indoDate2($o->tanggal); $serio[] = (int) $o->total; } $res['obat'] = ['kategori' => $kato, 'data' => $serio]; $katb = []; $serib = []; $barangs = data_po_item::grafikpembelian(2, $req->tahun)->get(); foreach ($barangs as $b) { $katb[] = \Format::indoDate2($b->tanggal); $serib[] = (int) $b->total; } $res['barang'] = ['kategori' => $katb, 'data' => $serib]; return json_encode($res); } }
protected function _to_client() { $web_format = config('settings', 'web_format'); header('Content-type: application/' . $web_format); echo Format::converter(Command::get_report(), $web_format); exit; }
function onTicketCreated($answer) { try { global $ost; if (!($ticket = Ticket::lookup($answer->object_id))) { die('Unknown or invalid ticket ID.'); } //Slack payload $payload = array('attachments' => array(array('pretext' => "New Ticket <" . $ost->getConfig()->getUrl() . "scp/tickets.php?id=" . $ticket->getId() . "|#" . $ticket->getId() . "> in " . Format::htmlchars($ticket->getDept() instanceof Dept ? $ticket->getDept()->getName() : '') . " via " . $ticket->getSource() . " (" . Format::db_datetime($ticket->getCreateDate()) . ")", 'fallback' => "New Ticket <" . $ost->getConfig()->getUrl() . "scp/tickets.php?id=" . $ticket->getId() . "|#" . $ticket->getId() . "> in " . Format::htmlchars($ticket->getDept() instanceof Dept ? $ticket->getDept()->getName() : '') . " via " . $ticket->getSource() . " (" . Format::db_datetime($ticket->getCreateDate()) . ")", 'color' => "#D00000", 'fields' => array(array('title' => "From: " . mb_convert_case(Format::htmlchars($ticket->getName()), MB_CASE_TITLE) . " (" . $ticket->getEmail() . ")", 'value' => '', 'short' => false))))); //Curl to webhook $data_string = utf8_encode(json_encode($payload)); $url = $this->getConfig()->get('slack-webhook-url'); if (!function_exists('curl_init')) { error_log('osticket slackplugin error: cURL is not installed!'); } $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $result = curl_exec($ch); if ($result === false) { error_log($url . ' - ' . curl_error($ch)); } else { $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($statusCode != '200') { error_log($url . ' Http code: ' . $statusCode); } } curl_close($ch); } catch (Exception $e) { error_log('Error posting to Slack. ' . $e->getMessage()); } }
public function getAllitems(Request $req) { if ($req->ajax()) { $res = []; $items = ref_jabatan::where('nm_jabatan', $req->src)->paginate(10); $out = ''; if ($items->total() > 0) { $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1; foreach ($items as $item) { $out .= ' <tr class="item_' . $item->id . ' items"> <td>' . $no . '</td> <td>' . $item->nm_jabatan . '</td> <td> <div> ' . \Format::indoDate($item->created_at) . ' </div> <small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small> </td> </tr> '; $no++; } } else { $out = ' <tr> <td colspan="3">Tidak ditemukan</td> </tr> '; } $res['data'] = $out; $res['pagin'] = $items->render(); return json_encode($res); } }
function getSubstitution() { $subs = array(); $subs['[today]'] = Format::date(date("Y-m-d H:i:s"), 'date'); $subs['[year]'] = date("Y"); return $subs; }
public static function converter($data, $format = NULL, $decode = FALSE) { if (!$format) { $format = config('data_format'); } if ($decode) { $result = array(); switch ($format) { case 'json': $result = json_decode($data, TRUE); break; } return is_array($result) ? $result : array(); } //encode switch ($format) { case 'json': Format::$_code = 0; return preg_replace_callback('/\\\\u([0-9a-f]{4})/i', function ($val) { $val = hexdec($val[1]); if (Format::$_code) { $val = ((Format::$_code & 0x3ff) << 10) + ($val & 0x3ff) + 0x10000; Format::$_code = 0; } elseif ($val >= 0xd800 and $val < 0xe000) { Format::$_code = $val; return ''; } return html_entity_decode(sprintf('&#x%x;', $val), ENT_NOQUOTES, 'utf-8'); }, json_encode($data)); break; } }
public function getTransaction($start_index, $results, $sort, $dir, $filter = false) { $query = "SELECT t.id_trans, t.date_creation, t.date_activated, t.paid, SUM(ti.price) as price, u.userid, u.firstname, u.lastname" . " FROM %adm_transaction as t" . " JOIN %adm_transaction_info as ti ON t.id_trans = ti.id_trans" . " JOIN %adm_user as u ON t.id_user = u.idst" . " WHERE 1"; $query .= " GROUP BY t.id_trans"; switch ($sort) { case 'userid': $query .= " ORDER BY u.userid " . $dir; break; case 'firstname': $query .= " ORDER BY u.firstname " . $dir; break; case 'lastname': $query .= " ORDER BY u.lastname " . $dir; break; case 'date_creation': $query .= " ORDER BY t.date_creation " . $dir; break; case 'date_activated': $query .= " ORDER BY t.date_activated " . $dir; break; } $start_index === false ? '' : ($query .= " LIMIT " . $start_index . ", " . $results); $result = sql_query($query); $res = array(); while ($row = sql_fetch_assoc($result)) { $row['userid'] = $this->acl_man->relativeId($row['userid']); $row['date_creation'] = Format::date($row['date_creation'], 'datetime'); $row['date_activated'] = Format::date($row['date_activated'], 'datetime'); $row['paid'] = $row['paid'] == 1 ? Get::img('standard/status_active.png', Lang::t('_ACTIVATED', 'transaction')) : Get::img('standard/status_deactive.png', Lang::t('_NOT_ACTIVATED', 'transaction')); $row['edit'] = '<a href="index.php?r=alms/transaction/mod&id_trans=' . $row['id_trans'] . '" title="' . Lang::t('_MOD', 'transaction') . '">' . Get::img('standard/edit.png', Lang::t('_MOD', 'transaction')) . '</a>'; $res[] = $row; } return $res; }
function Dados($setor) { $this->AddPage(); $this->setFillColor(200); $periodo = explode(' - ', Input::get('periodo')); $periodo[0] = Format::dbDate($periodo[0]); $periodo[1] = Format::dbDate($periodo[1]); $this->Cell(0, 5, $setor->descricao, 0, 0, 'C', 1); $this->Ln(); foreach ($setor->colaboradores()->orderBy('nome')->get() as $colaborador) { if ($colaborador->monitoramentos($periodo[0], $periodo[1])->count()) { $this->SetFont('Arial', '', 8); $this->Cell(0, 5, utf8_decode($colaborador->nome . ' - ' . $colaborador->posto_trabalho_descricao), 1, 0, 'L', 0); $this->Ln(); $this->SetFont('Arial', '', 6); $count = 0; foreach ($colaborador->monitoramentos($periodo[0], $periodo[1]) as $monitoramento) { $this->Cell(38, 4, date('d/m/Y', strtotime($monitoramento->created_at)) . ' - ' . utf8_decode(substr($monitoramento->diagnostico, 0, 17)), 0, 0, 'L', 0); $count = $count + 1; if ($count == 5) { $this->Ln(); $count = 0; } } $this->Ln(); } } }
/** * Execute the job. * * @return void */ public function handle() { try { \DB::begintransaction(); $sph = data_sph::find($this->id); $grup = data_sph_grup::whereId_sph_grup($sph->id_sph_grup)->select('status')->first(); if ($grup->status == 2) { throw new \Exception("Maaf SPH No. " . $sph->no_sph_item . " sudah kadaluarsa!", 1); } $nsph = data_sph::create(['id_sph_grup' => $sph->id_sph_grup, 'id_vendor' => $sph->id_vendor, 'deadline' => $sph->deadline, 'id_pembuat' => \Me::data()->id_karyawan, 'id_acc' => $sph->id_acc, 'diskon' => $sph->diskon, 'ppn' => $sph->ppn, 'pph' => $sph->pph, 'adjustment' => $sph->adjustment]); $items = data_sph_item::whereId_sph($this->id)->get(); foreach ($items as $item) { data_sph_item::create(['id_sph' => $nsph->id_sph, 'id_prq' => $item->id_prq, 'id_item' => $item->id_item, 'qty' => $item->qty, 'harga' => $item->harga, 'diskon' => $item->diskon, 'ppn' => $item->ppn, 'pph' => $item->pph, 'id_satuan' => $item->id_satuan]); } $fo = 'ISPH/'; $nsph->no_sph_item = $fo . \Format::code($nsph->id_sph); $nsph->save(); \Loguser::create('Menduplikasi data SPH dari No. ' . $sph->no_sph_item); \DB::commit(); return ['err' => 'SPH berhasil di duplikasi dengan No. ' . $nsph->no_sph_item]; } catch (\Exception $e) { \DB::rollback(); return ['err' => $e->getMessage()]; } }
public function testParseBBCode() { $this->assertEquals("", Format::parseBBCode("")); $this->assertEquals("test", Format::parseBBCode("test")); $this->assertEquals("<b>test</b>", Format::parseBBCode("[b]test[/b]")); // TODO complete }
public function Index($Offset = 0, $Limit = NULL) { $this->AddJsFile('/js/library/jquery.gardenmorepager.js'); $this->AddJsFile('search.js'); $this->Title(Translate('Search')); if (!is_numeric($Limit)) { $Limit = Gdn::Config('Garden.Search.PerPage', 20); } $Search = $this->Form->GetFormValue('Search'); $ResultSet = $this->SearchModel->Search($Search, $Offset, $Limit); $this->SetData('SearchResults', $ResultSet, TRUE); $this->SetData('SearchTerm', Format::Text($Search), TRUE); $NumResults = $ResultSet->NumRows(); if ($NumResults == $Offset + $Limit) { $NumResults++; } // Build a pager $PagerFactory = new PagerFactory(); $Pager = $PagerFactory->GetPager('MorePager', $this); $Pager->MoreCode = 'More Results'; $Pager->LessCode = 'Previous Results'; $Pager->ClientID = 'Pager'; $Pager->Configure($Offset, $Limit, $NumResults, 'garden/search/%1$s/%2$s/?Search=' . Format::Url($Search)); $this->SetData('Pager', $Pager, TRUE); $this->View = 'results'; $this->Render(); }
/** * @param array $data * * @return array */ public function processData(array $data = array()) { if (!$this->Format) { $this->loadFormat(); } return $this->Format->processData($data); }
public function Save($FormPostValues) { $Session = Gdn::Session(); // Define the primary key in this model's table. $this->DefineSchema(); // Add & apply any extra validation rules: $this->Validation->ApplyRule('Body', 'Required'); $this->AddInsertFields($FormPostValues); // Validate the form posted values $MessageID = FALSE; if ($this->Validate($FormPostValues)) { $Fields = $this->Validation->SchemaValidationFields(); // All fields on the form that relate to the schema $MessageID = $this->SQL->Insert($this->Name, $Fields); $ConversationID = ArrayValue('ConversationID', $Fields, 0); // Update the conversation's DateUpdated field $this->SQL->Update('Conversation')->Set('DateUpdated', Format::ToDateTime())->Set('UpdateUserID', $Session->UserID)->Where('ConversationID', $ConversationID)->Put(); // NOTE: INCREMENTING COUNTS INSTEAD OF GETTING ACTUAL COUNTS COULD // BECOME A PROBLEM. WATCH FOR IT. // Update the message counts for all users in the conversation $this->SQL->Update('UserConversation')->Set('CountMessages', 'CountMessages + 1', FALSE)->Where('ConversationID', $ConversationID)->Put(); $this->SQL->Update('UserConversation')->Set('CountNewMessages', 'CountNewMessages + 1', FALSE)->Where('ConversationID', $ConversationID)->Where('UserID <>', $Session->UserID)->Put(); // Update the CountUnreadConversations count on each user related to the discussion. $this->UpdateCountUnreadConversations($ConversationID, $Session->UserID); // Update the userconversation records to reflect the most recently // added message for all users other than the one that added the // message (otherwise they would see their name/message on the // conversation list instead of the person they are conversing with). $this->SQL->Update('UserConversation')->Set('LastMessageID', $MessageID)->Where('ConversationID', $ConversationID)->Where('UserID <>', $Session->UserID)->Put(); } return $MessageID; }
/** * Parse RFC 2397 formatted data strings. Format according to the RFC * should look something like: * * data:[type/subtype][;charset=utf-8][;base64],data[#filename] * * Parameters: * $data - (string) RFC2397 formatted data string * $output_encoding - (string:optional) Character set the input data * should be encoded to. * $always_convert - (bool|default:true) If the input data string does * not specify an input encding, assume iso-8859-1. If this flag is * set, the output will always be transcoded to the declared * output_encoding, if set. * * Returs: * array (data=>parsed and transcoded data string, type=>MIME type * declared in the data string or text/plain otherwise) * * References: * http://www.ietf.org/rfc/rfc2397.txt */ static function parse($data, $output_encoding = false, $always_convert = true) { if (substr($data, 0, 5) != "data:") { return array('data' => $data, 'type' => 'text/plain'); } $data = substr($data, 5); list($meta, $contents) = explode(",", $data, 2); if ($meta) { list($type, $extra) = explode(";", $meta, 2); } else { $extra = ''; } if (!isset($type) || !$type) { $type = 'text/plain'; } $parameters = explode(";", $extra); # Handle 'charset' hint in $extra, such as # data:text/plain;charset=iso-8859-1,Blah # Convert to utf-8 since it's the encoding scheme for the database. $charset = $always_convert ? 'iso-8859-1' : false; foreach ($parameters as $p) { list($param, $value) = explode('=', $extra); if ($param == 'charset') { $charset = $value; } elseif ($param == 'base64') { $contents = base64_decode($contents); } } if ($output_encoding && $charset) { $contents = Format::encode($contents, $charset, $output_encoding); } return array('data' => $contents, 'type' => $type); }
public function action_init_theme() { Format::apply('tag_and_list', 'post_tags_out', ', ', ', '); Format::apply_with_hook_params('more', 'post_content_out', 'More ›', null, 1); Stack::add('template_stylesheet', array(Site::get_url('theme') . '/css/screen.css', 'screen, projection'), 'screen'); Stack::add('template_stylesheet', array(Site::get_url('theme') . '/css/style.css', 'screen, projection'), 'style'); }
/** * Test for Format::forge($foo)->_from_xml() * * @test */ public function test__from_xml() { $xml = '<?xml version="1.0" encoding="UTF-8"?> <phpunit colors="true" stopOnFailure="false" bootstrap="bootstrap_phpunit.php"> <php> <server name="doc_root" value="../../"/> <server name="app_path" value="fuel/app"/> <server name="core_path" value="fuel/core"/> <server name="package_path" value="fuel/packages"/> </php> <testsuites> <testsuite name="core"> <directory suffix=".php">../core/tests</directory> </testsuite> <testsuite name="packages"> <directory suffix=".php">../packages/*/tests</directory> </testsuite> <testsuite name="app"> <directory suffix=".php">../app/tests</directory> </testsuite> </testsuites> </phpunit>'; $expected = array('@attributes' => array('colors' => 'true', 'stopOnFailure' => 'false', 'bootstrap' => 'bootstrap_phpunit.php'), 'php' => array('server' => array(0 => array('@attributes' => array('name' => 'doc_root', 'value' => '../../')), 1 => array('@attributes' => array('name' => 'app_path', 'value' => 'fuel/app')), 2 => array('@attributes' => array('name' => 'core_path', 'value' => 'fuel/core')), 3 => array('@attributes' => array('name' => 'package_path', 'value' => 'fuel/packages')))), 'testsuites' => array('testsuite' => array(0 => array('@attributes' => array('name' => 'core'), 'directory' => '../core/tests'), 1 => array('@attributes' => array('name' => 'packages'), 'directory' => '../packages/*/tests'), 2 => array('@attributes' => array('name' => 'app'), 'directory' => '../app/tests')))); $this->assertEquals(Format::forge($expected)->to_php(), Format::forge($xml, 'xml')->to_php()); }
public function format_root_set($open, $name, $attrs, $props) { if ($open) { parent::newChunk(); $this->cchunk = $this->dchunk; $pdfDoc = new PdfWriter(); try { $pdfDoc->setCompressionMode(\HaruDoc::COMP_ALL); } catch (\HaruException $e) { v("PDF Compression failed, you need to compile libharu with Zlib...", E_USER_WARNING); } parent::setPdfDoc($pdfDoc); if (isset($attrs[Reader::XMLNS_XML]["base"]) && ($base = $attrs[Reader::XMLNS_XML]["base"])) { parent::setChunkInfo("xml-base", $base); } $id = $attrs[Reader::XMLNS_XML]["id"]; $this->cchunk["root-outline"] = $this->cchunk["id-to-outline"][$id] = $pdfDoc->createOutline(Format::getShortDescription($id), null, true); $this->setIdToPage($id); } else { $this->resolveLinks($this->cchunk["setname"]); $pdfDoc = parent::getPdfDoc(); v("Writing Full PDF Manual (%s)", $this->cchunk["setname"], VERBOSE_TOC_WRITING); $filename = $this->getOutputDir(); if (Config::output_filename()) { $filename .= Config::output_filename(); } else { $filename .= strtolower($this->getFormatName()) . $this->getExt(); } $pdfDoc->saveToFile($filename); unset($pdfDoc); } return ""; }
public function ToString() { $String = ''; ob_start(); ?> <div class="Box"> <h4><?php echo Gdn::Translate('In this Discussion'); ?> </h4> <ul class="PanelInfo"> <?php foreach ($this->_UserData->Result() as $User) { ?> <li> <strong><?php echo Anchor($User->Name, '/profile/' . urlencode($User->Name), 'UserLink'); ?> </strong> <?php echo Format::Date($User->DateLastActive); ?> </li> <?php } ?> </ul> </div> <?php $String = ob_get_contents(); @ob_end_clean(); return $String; }
static function Instance() { if (!isset(self::$mrInstance)) { self::$mrInstance = new Format(); } return self::$mrInstance; }
/** * Execute the job. * * @return void */ public function handle() { try { \DB::begintransaction(); $me = \Me::data()->id_karyawan; $retur = data_retur::create(['tipe' => 2, 'id_po' => $this->req['id_po'], 'id_vendor' => $this->req['id_vendor'], 'id_karyawan' => $me]); data_po::find($this->req['id_po'])->update(['status' => 2]); foreach ($this->req['id_barang'] as $i => $id_barang) { if (!empty($this->req['qty'][$i])) { data_retur_item::create(['id_retur' => $retur->id_retur, 'id_barang' => $id_barang, 'id_satuan' => $this->req['id_satuan'][$i], 'qty' => $this->req['qty'][$i], 'qty_lg' => $this->req['qty'][$i]]); // Log Stok data_log_barang::create(['id_barang' => $id_barang, 'qty' => $this->req['qty'][$i], 'id_gudang' => 0, 'kondisi' => 2, 'tipe' => 5, 'id_parent' => $retur->id_retur, 'id_karyawan' => $me]); // Update stok $barang = data_barang::find($id_barang); $barang->out = $barang->out + $this->req['qty'][$i]; $barang->save(); // Update data PO items $itm = data_po_item::where('id_po', $this->req['id_po'])->where('id_item', $id_barang)->first(); $qpo = $itm->qty + $this->req['qty'][$i]; data_po_item::where('id_po', $this->req['id_po'])->where('id_item', $id_barang)->update(['qty' => $qpo, 'status' => 1]); } } $format = 'EX-RTN-'; $kode = $format . \Format::code($retur->id_retur); $retur->no_retur = $kode; $retur->save(); \Loguser::create('Membuat Retur Pembelian dengan No. ' . $kode); \DB::commit(); return ['result' => true, 'label' => 'success', 'err' => 'Return Pembelian berhasil dibuat dengan No. ' . $kode]; } catch (\Exception $e) { \DB::rollback(); return ['result' => false, 'label' => 'danger', 'err' => $e->getMessage()]; } }
/** * Execute the job. * * @return void */ public function handle() { try { \DB::begintransaction(); if ($this->req['id'] < 1) { $group = data_sph_grup::create(['id_pembuat' => \Me::data()->id_karyawan]); } else { $group = data_sph_grup::find($this->req['id']); \Loguser::create('Menambahkan Pengajuan pada SPH No. ' . $group->no_sph); } $sph = data_sph::create(['id_sph_grup' => $group->id_sph_grup, 'id_vendor' => $this->req['vendor'], 'deadline' => $this->req['deadline'], 'id_pembuat' => \Me::data()->id_karyawan, 'id_acc' => 0, 'diskon' => $this->req['gdiskon'], 'ppn' => $this->req['gppn'], 'adjustment' => $this->req['adjustment'], 'keterangan' => $this->req['ket']]); foreach ($this->req['id_prq_item'] as $i => $id_prq_item) { data_sph_item::create(['id_sph' => $sph->id_sph, 'id_prq' => $this->req['id_prq'][$i], 'id_item' => $this->req['id_barang'][$i], 'qty' => $this->req['qty'][$i], 'harga' => $this->req['harga'][$i], 'diskon' => $this->req['diskon'][$i], 'keterangan' => $this->req['kets'][$i], 'id_satuan' => $this->req['satuan'][$i]]); data_prq::find($this->req['id_prq'][$i])->update(['status' => 2]); } if ($this->req['id'] < 1) { $format = 'G-SPH/'; $group->no_sph = $format . \Format::code($group->id_sph_grup); $group->save(); \Loguser::create('Membuat Surat Pengajuan Harga dengan No. ' . $group->no_sph); } $fo = 'SPH/'; $sph->no_sph_item = $fo . \Format::code($sph->id_sph); $sph->save(); \DB::commit(); return ['status' => true, 'err' => $group]; } catch (\Exception $e) { \DB::rollback(); return ['status' => false, 'err' => $e->getMessage()]; } }
/** * Execute the job. * * @return void */ public function handle() { //dd($this->req); try { \DB::begintransaction(); $parent_id = empty($this->req['parent_id']) ? 0 : $this->req['parent_id']; $file = ''; if (!empty($_FILES['feed_file']['tmp_name'])) { $base_name = date('d_m_Y_') . md5($_FILES['feed_file']['name']) . rand(11111, 99999) . time(); $fl_name = $base_name . '.png'; $fl = file_get_contents($_FILES['feed_file']['tmp_name']); \Image::make($fl)->save($this->path . $fl_name); $file = $fl_name; } $feed = data_feedback::create(['title' => $this->req['feed_title'], 'ask' => $this->req['feed_ask'], 'link' => $this->req['feed_link'], 'parent_id' => $parent_id, 'file' => $file, 'id_karyawan' => \Me::data()->id_karyawan]); $kode = \Format::code($feed->id_feedback); $feed->kode = $kode; $feed->save(); if ($parent_id > 0) { $up = data_feedback::find($parent_id); $up->notif = $up->notif + 1; $up->save(); } \Loguser::create('Megisi form feedback Kode. #' . $kode); \DB::commit(); return ['label' => 'success', 'err' => 'Feedback berhasil terkirim dengan Kode. ' . $feed->kode]; } catch (\Exception $e) { \DB::rollback(); if (file_exists($this->path . $file)) { @unlink($this->path . $file); } return ['label' => 'danger', 'err' => $e->getMessage()]; } }