NEOGROUND/CHARM: THE CHARMING PHP FRAMEWORK

PHP..

Bạn đang xem: Neoground/charm: the charming php framework

Charm - 3 examples found
. These are the top rated real world PHP examples of Charm extracted from open source projects. You can rate examples to help us improve the chất lượng of examples.
/** * Run by monthly cron khổng lồ create CSV and send out charm 10/50k PRS orders */ public function report_10k() { ini_set("max_execution_time", 900); ini_set("max_input_time", 60); ini_set("memory_limit", "2048M"); $charm = new Charm(); unset($this->Order->virtualFields); $validStatuses = $this->Order->getCommissionableStatusesString(); //MIKEFIX $sql = " SELECT sum(commissionable_total) as total, u.first_name, u.last_name, p.presenter_sequence_id, p.id, p.market_id, u.id, e.email FROM orders o JOIN presenters p ON p.id = o.presenter_id JOIN users u ON u.id = p.user_id JOIN emails e ON u.id = e.user_id AND e.email_type_id = 1 WHERE order_type_id = 3 AND order_status_id IN $validStatuses GROUPhường BY presenter_id HAVING total >= 10000 "; $this->out("Starting large SQL call....", Shell::NORMAL); $tenK = $this->Order->query($sql); $this->out("Finished SQL call", Shell::NORMAL); $results = <>; foreach ($tenK as $value) if ($value<0><'total'> Address->find('first', array('conditions' => array('user_id' => $value<'u'><'id'>, 'address_type_id' => 2, 'address1 is not null'), 'contain' => array('State', 'Country'), 'order' => array('Address.id desc'))); $hit_10k = FALSE; $hit_50k = FALSE; $hit_100k = FALSE; $hit_500k = FALSE; $hit_1M = FALSE; $sum = 0; $orders = $this->Order->find('all', array('conditions' => <'presenter_id' => $value<'p'><'id'>, 'order_type_id' => 3, 'order_status_id' => $this->Order->getCommissionableStatuses()>, 'order' => 'date_completed asc')); foreach ($orders as $order) $sum += $order<'Order'><'commissionable_total'>; if ($sum >= 10000 &và $hit_10k === FALSE) $results<$value<'p'><'presenter_sequence_id'>><'club'><'10k'> = $order<'Order'><'date_completed'>; $hit_10k = TRUE; elseif ($sum >= 50000 &và $hit_50k === FALSE) $results<$value<'p'><'presenter_sequence_id'>><'club'><'50k'> = $order<'Order'><'date_completed'>; $hit_50k = TRUE; elseif ($sum >= 100000 &và $hit_100k === FALSE) $results<$value<'p'><'presenter_sequence_id'>><'club'><'100k'> = $order<'Order'><'date_completed'>; $hit_100k = TRUE; elseif ($sum >= 500000 && $hit_500k === FALSE) $results<$value<'p'><'presenter_sequence_id'>><'club'><'500k'> = $order<'Order'><'date_completed'>; $hit_100k = TRUE; elseif ($sum >= 1000000 && $hit_1M === FALSE) $results<$value<'p'><'presenter_sequence_id'>><'club'><'1M'> = $order<'Order'><'date_completed'>; $hit_100k = TRUE; $tmp_dir = sys_get_temp_dir(); $fp = fopen($tmp_dir . '/10k_club.csv', 'w'); $header = array('Presenter Id', 'Name', 'Total', '10K', '50k', '100k', 'Addr1', 'Addr2', 'Addr3', 'City', 'State', 'Zip', 'Country', 'Club'); fputcsv($fp, $header); foreach ($results as $line) $val = array(); $val<> = $line<'p'><'presenter_sequence_id'>; $val<> = $line<'u'><'first_name'> . " " . $line<'u'><'last_name'>; $val<> = $line<'0'><'total'>; $val<> = $line<'club'><'10k'>; $val<> = $line<'club'><'50k'>; $val<> = $line<'club'><'100k'>; $val<> = $line<'consultant_address'><'Address'><'address1'>; $val<> = $line<'consultant_address'><'Address'><'address2'>; $val<> = $line<'consultant_address'><'Address'><'address3'>; $val<> = $line<'consultant_address'><'Address'><'city'>; $val<> = $line<'consultant_address'><'State'><'name'>; $val<> = $line<'consultant_address'><'Address'><'postal_code'>; $val<> = $line<'consultant_address'><'Country'><'name'>; //create comparison year/month $prev_month = date("Y-m", strtotime('first day of previous month')); $club = ''; if (substr($line<'club'><'10k'>, 0, 7) == $prev_month) $club = '10k'; elseif (substr($line<'club'><'50k'>, 0, 7) == $prev_month) $club = '50k'; if (!empty($club)) $recipient = <"first_name" => $line<'u'><'first_name'>, "last_name" => $line<'u'><'last_name'>, "address1" => $line<'consultant_address'><'Address'><'address1'>, "address2" => $line<'consultant_address'><'Address'><'address2'>, "address3" => $line<'consultant_address'><'Address'><'address3'>, "city" => $line<'consultant_address'><'Address'><'city'>, "state" => $line<'consultant_address'><'State'><'name'>, "postcode" => $line<'consultant_address'><'Address'><'postal_code'>, "country" => $line<'consultant_address'><'Country'><'name'>, "achievement" => $club, "presenter_id" => $line<'p'><'id'>, "user_id" => $line<'u'><'id'>, "email" => $line<'e'><'email'>, "market_id" => $line<'p'><'market_id'>>; if ($order_id = $charm->createCharmOrders($recipient)) $this->out('Charm Order: ' .

Xem thêm: Cách Sửa Lỗi Memory Management Internal Trên Windows, Lỗi Màn Hình Xanh Memory Management

$order_id . ' (Market:' . $recipient<'market_id'> . ') (Club:' . $club . ') Ready for NetSuite.', Shell::NORMAL); else $this->out("ERROR - Order not created", Shell::NORMAL); $val<> = $club; fputcsv($fp, $val); fclose($fp); if (YOUNIQUE_TESTSERVER != TRUE) { $file = $tmp_dir . '/10k_club.csv'; $link = $this->_upload("10K.csv", $file); $this->out('Test server: ' . YOUNIQUE_TESTSERVER ? "Yes" : "No"); $this->_sendEmail("presenter_accomplishment_reports