本文整理汇总了PHP中Dwoo_Data::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP Dwoo_Data::assign方法的具体用法?PHP Dwoo_Data::assign怎么用?PHP Dwoo_Data::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dwoo_Data
的用法示例。
在下文中一共展示了Dwoo_Data::assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendCallBack
public function sendCallBack()
{
if ($this->request->post('name') && $this->request->post('phone')) {
$name = $this->request->post('name');
$phone = $this->request->post('phone');
$insert = $this->database->insert("callback", array("idate" => time(), "name_rus" => $name, "phone" => $phone));
if ($insert) {
$data = new Dwoo_Data();
$data->assign("date", date("d-m-Y H:s:i", time()));
$data->assign("name", $name);
$data->assign("phone", $phone);
$message = $this->dwoo->get("email/call-me.php", $data);
$mail = new PHPMailer(true);
$mail->From = "admin@interline.ua";
$mail->FromName = "Interline";
$mail->CharSet = "utf-8";
$mail->Subject = "Обратная связь";
$mail->IsHTML(true);
$mail->MsgHTML($message);
$emails = $this->model->cms_interface()->where("label=", "email-callme")->getOne();
$emails = strip_tags(trim($emails['content']));
$emails = explode(",", $emails);
foreach ($emails as $one) {
if (!empty($one)) {
$mail->AddAddress(trim($one));
$mail->Send();
$mail->ClearAddresses();
}
}
jsonout(array("ok" => 1));
}
}
}
示例2: render
/**
* {@inheritdoc}
*/
public function render($viewName, Model $model, NotificationCenter $notificationCenter, $output = true)
{
Profile::start('Renderer', 'Generate HTML');
$templateName = $viewName . '.' . static::$templateFileExtension;
$dwoo = new Dwoo($this->compiledPath, $this->cachePath);
$dwoo->getLoader()->addDirectory($this->functionsPath);
Profile::start('Renderer', 'Create template file.');
$template = new Dwoo_Template_File($templateName);
$template->setIncludePath($this->getTemplatesPath());
Profile::stop();
Profile::start('Renderer', 'Render');
$dwooData = new Dwoo_Data();
$dwooData->setData($model->getData());
$dwooData->assign('errorMessages', $notificationCenter->getErrors());
$dwooData->assign('successMessages', $notificationCenter->getSuccesses());
$this->setHeader('Content-type: text/html', $output);
// I do never output directly from dwoo to have the possibility to show an error page if there was a render error.
$result = $rendered = $dwoo->get($template, $dwooData, null, false);
if ($output) {
echo $result;
}
Profile::stop();
Profile::stop();
return $output ? null : $rendered;
}
示例3: getYmlTemplate
public function getYmlTemplate($products, $catalog = false)
{
$data = new Dwoo_Data();
$data->assign("products", $products);
$data->assign("catalog", $catalog);
$data->assign("course", $this->course);
$xml = $this->dwoo->get("xml/yml.php", $data);
file_put_contents($this->dir . "yml.xml", $xml);
return $xml;
}
示例4: testAppend
public function testAppend()
{
$data = new Dwoo_Data();
$data->assign('var', 'val');
$data->append('var', 'moo');
$this->assertEquals(array('var' => array('val', 'moo')), $data->getData());
$data->assign('var', 'val');
$data->append(array('var' => 'moo', 'var2' => 'bar'));
$this->assertEquals(array('var' => array('val', 'moo'), 'var2' => array('bar')), $data->getData());
}
示例5: _assign
protected function _assign(Dwoo_Data $data)
{
try {
$details = $this->_eventData->getAllDetails();
$arrayDetails = array();
foreach ($details as $detail) {
$arrayDetails[] = array('unit' => $detail->getUnit()->toArray(), 'period' => (array) $detail->getPeriod(), 'periodtime' => (array) $detail->getPeriod(true), 'persons' => $detail->getPersons()->getAll(), 'total' => $detail->getTotal());
}
$data->assign('details', $arrayDetails);
$data->assign('user', $this->_eventData->getUser()->toArray());
$data->assign('reservation_id', $this->_eventData->getReservationID());
} catch (Exception $e) {
return false;
}
return $data;
}
示例6: _assign
protected function _assign(Dwoo_Data $data)
{
$user = $this->_eventData->getUser();
$user = $user->toArray();
$data->assign('user', $user);
return $data;
}
示例7: getInvoice
/**
* Method that parsed invoice template and returns string
*
* All variable that parsed into invoice.pthml template
* $reservation:
* $reservation.id
* $reservation.user_id
* $reservation.confirmed (Yes, No - translated)
* $reservation.is_read (Yes, No - translated)
* $reservation.creation_datetime (In MySQL format: Y-m-d H:m:s)
* $reservation.modified_datetime (In MySQL format: Y-m-d H:m:s)
* $reservation.notes
* $reservation.tax
* $reservation.paid
* $reservation.due
*
* $customer:
* $customer.id
* $customer.title (Translated)
* $customer.first_name
* $customer.last_name
* $customer.address1
* $customer.address2
* $customer.state
* $customer.city
* $customer.postcode
* $customer.country
* $customer.telephone
* $customer.mobile
* $customer.email
* $customer.username
*
* $details each detail is an $element:
* $element.reservation_id
* $element.unit_id
* $element.start_datetime (In MySQL format: Y-m-d H:m:s)
* $element.end_datetime (In MySQL format: Y-m-d H:m:s)
* $element.total_price
* $element.unit.id
* $element.unit.rating (number)
* $element.unit.published (Yes, No - translated)
* $element.unit.color (hex color)
* $element.unit.(all language db field names that are belong to unit type, for example: name, summary, description)
*
* $text: all text constants in section 'Admin.Invoice' in languages file, for example $text.BookingReference
*
* @param RM_Reservation_Row $reservation
* @return <type>
*/
public static function getInvoice(RM_Reservation_Row $reservation)
{
$translate = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN);
$data = new Dwoo_Data();
$data->assign('invoice', array('date' => date('d/m/Y')));
$config = new RM_Config();
$data->assign('currencysymbol', $config->getCurrencySymbol());
//TODO: resmania - we need to add discounts and coupons here
$reservationArray = $reservation->toArray();
$billing = new RM_Billing();
$priceCharges = $billing->getPrice($reservation->id);
$reservationArray['tax'] = $priceCharges->tax;
$reservationArray['paid'] = $billing->getPaymentsTotal($reservation);
$reservationArray['due'] = abs($priceCharges->total - $billing->getPaymentsTotal($reservation));
$reservationArray['total'] = $priceCharges->total;
$reservationArray['confirmed'] = $reservation->confirmed ? $translate->_('MessageYes') : $translate->_('MessageNo');
$reservationArray['is_read'] = $reservation->is_read ? $translate->_('MessageYes') : $translate->_('MessageNo');
$data->assign('reservation', $reservationArray);
$text = $translate->getSectionMessages('Common.Invoice');
$data->assign('text', $text);
$userModel = new RM_Users();
$user = $userModel->getByReservation($reservation);
if ($user == null) {
$userArray = array();
} else {
$userArray = $user->toArray();
$userArray['title'] = $user->getTitle();
}
$data->assign('customer', $userArray);
$reservationDetailsModel = new RM_ReservationDetails();
$summaryModel = new RM_ReservationSummary();
$details = $reservationDetailsModel->getAllByReservation($reservation);
$arrayDetails = array();
foreach ($details as $detail) {
$arrayDetail = $detail->toArray();
$unit = $detail->findUnit();
$unitArray = $unit->toArray();
$unitArray['id'] = $unit->getId();
$unitArray['published'] = $unitArray->published ? $translate->_('MessageYes') : $translate->_('MessageNo');
// format the start/end dates
$arrayDetail['start_datetime'] = $config->convertDates($arrayDetail['start_datetime'], RM_Config::PHP_DATEFORMAT, RM_Config::JS_DATEFORMAT);
$arrayDetail['end_datetime'] = $config->convertDates($arrayDetail['end_datetime'], RM_Config::PHP_DATEFORMAT, RM_Config::JS_DATEFORMAT);
// extras
$reservationDetailsExtra = $summaryModel->fetchByReservationDetail($detail)->toArray();
foreach ($reservationDetailsExtra as $extra) {
if ($extra['value'] == 0) {
$extra['value'] = "";
}
$unitArray['extras'][] = array("name" => $extra['name'], "value" => $extra['value'], "total_amount" => $extra['total_amount']);
}
$arrayDetail['unit'] = $unitArray;
//.........这里部分代码省略.........
示例8: GenerateModLogRSS
function GenerateModLogRSS()
{
global $tc_db;
require_once KU_ROOTDIR . 'lib/dwoo.php';
$dwoo = new Dwoo();
$dwoo_data = new Dwoo_Data();
$entries = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "modlog` ORDER BY `timestamp` DESC LIMIT 15");
$dwoo_data->assign('entries', $entries);
$rss = $dwoo->get(KU_TEMPLATEDIR . '/rss_mod.tpl', $dwoo_data);
return $rss;
}
示例9: _assign
protected function _assign(Dwoo_Data $data)
{
$details = $this->_eventData->getAllDetails();
$reservationID = $this->_eventData->getReservationID();
$reservationModel = new RM_Reservations();
$reservation = $reservationModel->find($reservationID)->current();
$arrayDetails = array();
foreach ($details as $detail) {
$arrayDetails[] = array('unit' => $detail->getUnit()->toArray(), 'period' => (array) $detail->getPeriod(), 'periodtime' => (array) $detail->getPeriod(true), 'persons' => $detail->getPersons(), 'total' => $detail->getTotal());
}
// total paid and total due
$billing = new RM_Billing();
$priceCharges = $billing->getPrice($reservationID);
$billingArray['tax'] = $priceCharges->tax;
$billingArray['paid'] = $billing->getPaymentsTotal($reservation);
$billingArray['due'] = $priceCharges->total;
$billingArray['confirmed'] = $reservation->confirmed ? $translate->_('MessageYes') : $translate->_('MessageNo');
$data->assign('details', $arrayDetails);
$data->assign('reservation_id', $this->_eventData->getReservationID());
return $data;
}
示例10: _assign
protected function _assign(Dwoo_Data $data)
{
$translate = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN);
$locationsDAO = new RM_Locations();
$reservationID = $this->_eventData->getReservationID();
$reservationModel = new RM_Reservations();
$reservation = $reservationModel->find($reservationID)->current();
// reservation details
$details = $this->_eventData->getAllDetails();
$arrayDetails = array();
foreach ($details as $detail) {
$unit = $detail->getUnit()->toArray();
$period = $detail->getPeriod()->toArray();
$periodWithTime = $detail->getPeriod()->toArray(true);
$location = $locationsDAO->fetchByUnit($unit['id'])->toArray();
$extrasForTemplate = array();
$extras = $detail->getExtras();
foreach ($extras as $extra) {
$extrasForTemplate[] = $extra->toArray();
}
$arrayDetails[] = array('unit' => $unit, 'locationInfo' => isset($location[0]) ? $location[0] : '', 'period' => $period, 'periodtime' => $periodWithTime, 'persons' => $detail->getPersons()->getAll(), 'total' => $detail->getTotal(), 'extras' => $extrasForTemplate);
}
// total paid and total due
$billing = new RM_Billing();
$priceCharges = $billing->getPrice($reservationID);
$billingArray['tax'] = $priceCharges->tax;
$billingArray['paid'] = $billing->getPaymentsTotal($reservation);
$billingArray['due'] = $priceCharges->total;
$billingArray['confirmed'] = $reservation->confirmed ? $translate->_('MessageYes') : $translate->_('MessageNo');
// return the data to the template
$data->assign('extras', $extrasForTemplate);
$data->assign('details', $arrayDetails);
$data->assign('user', $this->_eventData->getUser()->toArray());
$data->assign('reservation_id', $reservationID);
$data->assign('billing', $billingArray);
return $data;
}
示例11: startFollow
public function startFollow()
{
$filename = APP_DIR . 'cron/block.php';
$new_array = array();
$follow_price = $this->model->follow_price()->joined(true)->order("pos ASC")->getByActive(1);
foreach ($follow_price as $key => $item) {
$email = strtolower(trim($item['email']));
$new_array[$email][] = $item;
}
foreach ($new_array as $key => $item) {
foreach ($item as $k => $v) {
$new_array[$key][$k]['new_price'] = $v['product']['price'];
if ($v['old_price'] <= $v['product']['price']) {
unset($new_array[$key][$k]);
} else {
$this->database->update('follow_price', array('old_price' => $v['new_price'], 'procent' => $v['old_price'] - $v['new_price']), array('id' => $v['id']));
}
}
}
foreach ($new_array as $key => $item) {
if (isset($item) && is_array($item) && !empty($item)) {
$data = new Dwoo_Data();
$data->assign('products', $item);
$message = $this->dwoo->get("email/follow-mail.php", $data);
$mail = new PHPMailer(true);
$mail->From = "admin@interline.ua";
$mail->FromName = "Interline";
$mail->CharSet = "utf-8";
$mail->Subject = "Скидка на товары";
$mail->IsHTML(true);
$mail->MsgHTML($message);
$mail->AddAddress(trim($key));
$mail->Send();
$mail->ClearAddresses();
}
}
}
示例12: array
$result = $db->Execute('SELECT * FROM ' . DB::$calls . ' ORDER BY ' . DB::$calls_start_time . ' DESC');
$total_call_duration = 0;
$total_call_count = $result->RecordCount();
// This data is used by the JS charting library to display a dot chart
// showing the calls received each hour. Each slot in the array
// corresponds to an hour in the day.
$call_volume_chart_data = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
while ($row = $result->FetchRow()) {
$from = $row[DB::$calls_from];
$location = $row[DB::$calls_location];
$start_time = new DateTime($row[DB::$calls_start_time], $server_timezone);
$duration = ceil($row[DB::$calls_duration] / 60);
$total_call_duration += $duration;
$call_volume_chart_data[$start_time->format('G')] += 1;
$start_time->setTimezone($local_timezone);
$call['from'] = format_phone_number($from);
$call['location'] = $location;
$call['start_time'] = $start_time->format('F j, Y \\a\\t g:i A');
$call['duration'] = $duration;
$calls[] = $call;
}
} catch (ADODB_Exception $e) {
$error = 'An error occurred while connecting to the database. Please try again later.';
}
$data->assign('total_call_count', $total_call_count);
$data->assign('total_call_duration', $total_call_duration);
$data->assign('total_spent', money_format('%i', $total_call_duration * CALL_COST));
$data->assign('call_volume_chart_data', implode(', ', $call_volume_chart_data));
$data->assign('calls', $calls);
$data->assign('error', $error);
$dwoo->output($tpl, $data);
示例13: isset
<?php
include_once "./global.php";
$tpl = new Dwoo_Template_File(template("compare_hosts.tpl"));
$data = new Dwoo_Data();
$data->assign("range", $range);
$size = isset($clustergraphsize) ? $clustergraphsize : 'default';
//set to 'default' to preserve old behavior
$size = $size == 'medium' ? 'default' : $size;
retrieve_metrics_cache();
$matches = array();
if (array_key_exists('hreg', $_GET)) {
foreach ($_GET['hreg'] as $key => $query) {
if ($query != '') {
foreach ($index_array['hosts'] as $key => $host_name) {
if (preg_match("/{$query}/i", $host_name)) {
// We can have same hostname in multiple clusters
foreach ($index_array['cluster'][$host_name] as $clustername) {
$matches[] = array("hostname" => $host_name, "clustername" => $clustername);
}
}
}
}
}
}
#print "<PRE>";print_r($index_array['metrics']);
$host_metrics = array();
$host_cluster = array();
foreach ($matches as $index => $match) {
$hostname = $match['hostname'];
$host_cluster[] = $match['hostname'] . "|" . $match['clustername'];
示例14: room
<?php
/* $Id$ */
$tpl = new Dwoo_Template_File(template("meta_view.tpl"));
$data = new Dwoo_Data();
discover_filters();
if (!empty($filter_defs)) {
$data->assign("filters", $filter_defs);
$data->assign("choose_filter", $choose_filter);
}
# Find the private clusters. But no one is emabarrassed in the
# control room (public only!).
if ($context != "control") {
$private = embarrassed();
}
$source_names = array_keys($grid);
# Build a list of cluster names and randomly pick a smaller subset to
# display for control room mode. This allows a dedicated host to
# eventually cycle through all the graphs w/o scrolling the mouse. A bunch
# of these stations could monitor a large grid.
#
# For the standard meta view still display all the hosts.
if ($context == "control") {
srand((double) microtime() * 1000000);
shuffle($source_names);
$subset = array_slice($source_names, 0, abs($controlroom));
$source_names = $subset;
}
foreach ($source_names as $c) {
$cpucount = $metrics[$c]["cpu_num"]['SUM'];
if (!$cpucount) {
示例15: isset
<?php
$tpl = new Dwoo_Template_File(template("compare_hosts.tpl"));
$data = new Dwoo_Data();
$data->assign("range", $range);
$size = isset($clustergraphsize) ? $clustergraphsize : 'default';
//set to 'default' to preserve old behavior
$size = $size == 'medium' ? 'default' : $size;
retrieve_metrics_cache();
$matches = array();
if (array_key_exists('hreg', $_GET)) {
foreach ($_GET['hreg'] as $key => $query) {
if ($query != '') {
foreach ($index_array['hosts'] as $key => $host_name) {
if (preg_match("/{$query}/i", $host_name)) {
// We can have same hostname in multiple clusters
$matches[] = array("hostname" => $host_name, "clustername" => $index_array['cluster'][$host_name]);
}
}
}
}
}
#print "<PRE>";print_r($index_array['metrics']);
$host_metrics = array();
$host_cluster = array();
foreach ($matches as $index => $match) {
$hostname = $match['hostname'];
$host_cluster[] = $match['hostname'] . "|" . $match['clustername'];
foreach ($index_array['metrics'] as $metric_name => $hosts) {
if (array_search($hostname, $hosts) !== FALSE && !isset($host_metrics[$metric_name])) {
$host_metrics[$metric_name] = 1;