本文整理汇总了PHP中Dwoo_Data类的典型用法代码示例。如果您正苦于以下问题:PHP Dwoo_Data类的具体用法?PHP Dwoo_Data怎么用?PHP Dwoo_Data使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Dwoo_Data类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _assign
protected function _assign(Dwoo_Data $data)
{
$user = $this->_eventData->getUser();
$user = $user->toArray();
$data->assign('user', $user);
return $data;
}
示例2: 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));
}
}
}
示例3: 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;
}
示例4: 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;
//.........这里部分代码省略.........
示例5: testUnassign
/**
* @expectedException Dwoo_Exception
*/
public function testUnassign()
{
$data = new Dwoo_Data();
$data->variable = 'val';
$this->assertEquals(true, isset($data->variable));
$data->unassign('variable');
$data->get('variable');
}
示例6: 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;
}
示例7: 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;
}
示例8: _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;
}
示例9: 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());
}
示例10: _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;
}
示例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: _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;
}
示例13: _parse_compiled
/**
* Parse
*
* Parses pseudo-variables contained in the specified template,
* replacing them with the data in the second param
*
* @access public
* @param string
* @param array
* @param bool
* @param string
* @return string
*/
public function _parse_compiled($string, $data, $return = FALSE, $cache_id = NULL)
{
// Start benchmark
$this->_ci->benchmark->mark('dwoo_parse_start');
// Convert from object to array
if (!is_array($data)) {
$data = (array) $data;
}
$data = array_merge($this->_ci->load->get_vars(), $data);
foreach ($this->_parser_assign_refs as $ref) {
$data[$ref] =& $this->_ci->{$ref};
}
// Object containing data
$dwoo_data = new Dwoo_Data();
$dwoo_data->setData($data);
$parsed_string = '';
try {
// Object of the template
$tpl = new Dwoo_Template_String($string, NULL, $cache_id, NULL);
$dwoo = !isset($this->_dwoo) ? self::spawn() : $this->_dwoo;
// check for existence of dwoo object... may not be there if folder is not writable
// added by David McReynolds @ Daylight Studio 1/20/11
if (!empty($dwoo)) {
// Create the compiler instance
$compiler = new Dwoo_Compiler();
// added by David McReynolds @ Daylight Studio 1/22/12
$compiler->setDelimiters($this->l_delim, $this->r_delim);
//Add a pre-processor to help fix javascript {}
// added by David McReynolds @ Daylight Studio 11/04/10
$callback = create_function('$compiler', '
$string = $compiler->getTemplateSource();
$callback = create_function(\'$matches\',
\'if (isset($matches[1]))
{
$str = "<script";
$str .= preg_replace("#\\' . $this->l_delim . '([^s])#ms", "' . $this->l_delim . ' $1", $matches[1]);
$str .= "</script>";
return $str;
}
else
{
return $matches[0];
}
\'
);
$string = preg_replace_callback("#<script(.+)</script>#Ums", $callback, $string);
$compiler->setTemplateSource($string);
return $string;
');
$compiler->addPreProcessor($callback);
// render the template
$parsed_string = $dwoo->get($tpl, $dwoo_data, $compiler);
} else {
// load FUEL language file because it has the proper error
// added by David McReynolds @ Daylight Studio 1/20/11
$this->_ci->load->module_language(FUEL_FOLDER, 'fuel');
throw new Exception(lang('error_folder_not_writable', $this->_ci->config->item('cache_path')));
}
} catch (Exception $e) {
if (strtolower(get_class($e)) == 'dwoo_exception') {
echo '<div class="error">' . $e->getMessage() . '</div>';
} else {
show_error($e->getMessage());
}
}
// Finish benchmark
$this->_ci->benchmark->mark('dwoo_parse_end');
// Return results or not ?
if (!$return) {
$this->_ci->output->append_output($parsed_string);
return;
}
return $parsed_string;
}
示例14: Dwoo_Template_File
#
# Although this page repeats some information from
# host_view, it had the concept of Constant Metrics before
# the SLOPE=zero attribute. It also uses style sheets for clean
# looks. In the future, it may display process information for
# the node as well.
#
# Originally by Federico Sacerdoti <fds@sdsc.edu>
#
# Host is specified in get_context.php.
if (empty($hostname)) {
print "<h1>Missing a Node Name</h1>";
return;
}
$tpl = new Dwoo_Template_File(template("show_node.tpl"));
$data = new Dwoo_Data();
$data->assign("extra", template("node_extra.tpl"));
$up = $hosts_up ? 1 : 0;
$class = $up ? "even" : "down";
$data->assign("class", $class);
$data->assign("name", $hostname);
# $metrics is an array of [Metrics][Hostname][NAME|VAL|TYPE|UNITS|SOURCE].
# Find the host's physical location in the cluster.
$hostattrs = $up ? $hosts_up : $hosts_down;
list($rack, $rank, $plane) = findlocation($hostattrs);
$location = $rack < 0 ? "Unknown" : "Rack {$rack}, Rank {$rank}, Plane {$plane}.";
$data->assign("location", $location);
if (isset($hostattrs['ip'])) {
$data->assign("ip", $hostattrs['ip']);
} else {
$data->assign("ip", "");
示例15: Dwoo_Template_File
<?php
$tpl = new Dwoo_Template_File(template("decompose_graph.tpl"));
$data = new Dwoo_Data();
$data->assign("range", $range);
$graph_type = "line";
$line_width = "2";
$user['view_name'] = isset($_GET["vn"]) ? sanitize($_GET["vn"]) : NULL;
$user['item_id'] = isset($_GET["item_id"]) ? sanitize($_GET["item_id"]) : NULL;
#################################################################################
# Let's check if we are decomposing a composite graph from a view
#################################################################################
if ($user['view_name'] and $user['item_id']) {
$available_views = get_available_views();
foreach ($available_views as $id => $view) {
# Find view settings
if ($user['view_name'] == $view['view_name']) {
break;
}
}
unset($available_views);
foreach ($view['items'] as $index => $graph_config) {
if ($user['item_id'] == $graph_config['item_id']) {
break;
}
}
unset($view);
$title = "";
} else {
if (isset($_GET['aggregate'])) {
$graph_config = build_aggregate_graph_config($graph_type, $line_width, $_GET['hreg'], $_GET['mreg']);