本文整理汇总了PHP中F0FTable::getAnInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP F0FTable::getAnInstance方法的具体用法?PHP F0FTable::getAnInstance怎么用?PHP F0FTable::getAnInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F0FTable
的用法示例。
在下文中一共展示了F0FTable::getAnInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onBeforeDelete
protected function onBeforeDelete($oid)
{
$status = true;
// load cart items
$query = $this->_db->getQuery(true);
$query->select('*')->from('#__j2store_cartitems')->where('cart_id = ' . (int) $oid);
$this->_db->setQuery($query);
try {
$items = $this->_db->loadObjectList();
// foreach orderitem
foreach ($items as $item) {
// remove from user's cart
if (!F0FTable::getAnInstance('Cartitem', 'J2StoreTable')->delete($item->j2store_cartitem_id)) {
//F0FTable::getAnInstance ( 'Cartitem', 'J2StoreTable' )->getError();
break;
return false;
} else {
J2Store::plugin()->event('RemoveCartItem', array($item));
$status = true;
}
}
} catch (Exception $e) {
// do nothing
}
return $status;
}
示例2: deleteChildren
public function deleteChildren($oid)
{
$status = true;
//should delete geozonerules
$geozonerules = F0FModel::getTmpInstance('GeozoneRules', 'J2StoreModel')->geozone_id($oid)->getList();
$geozonerule = F0FTable::getAnInstance('GeozoneRule', 'J2StoreTable');
if (isset($geozonerules) && count($geozonerules)) {
foreach ($geozonerules as $grule) {
if (!$geozonerule->delete($grule->j2store_geozonerule_id)) {
$status = false;
}
}
}
if ($status) {
// delete taxrate and also related taxprofile rules...
$taxrates = F0FModel::getTmpInstance('Taxrates', 'J2StoreModel')->geozone_id($oid)->getList();
$taxrate = F0FTable::getAnInstance('Taxrate', 'J2StoreTable');
if (isset($taxrates) && count($taxrates)) {
foreach ($taxrates as $trate) {
if (!$taxrate->delete($trate->j2store_taxrate_id)) {
$status = false;
}
}
}
}
return $status;
}
示例3: onAdd
protected function onAdd($tpl = null)
{
$app = JFactory::getApplication();
JRequest::setVar('hidemainmenu', true);
$model = $this->getModel();
$this->item = $model->runMyBehaviorFlag(true)->getItem();
$this->currency = J2Store::currency();
$this->form_prefix = $this->input->getString('form_prefix', '');
$this->product_source_view = $this->input->getString('product_source_view', 'article');
$this->product_types = JHtml::_('select.genericlist', $model->getProductTypes(), $this->form_prefix . '[product_type]', array(), 'value', 'text', $this->item->product_type);
if ($this->item->j2store_product_id) {
//manufacturers
$this->manufacturers = J2Html::select()->clearState()->type('genericlist')->name($this->form_prefix . '[manufacturer_id]')->value($this->item->manufacturer_id)->setPlaceHolders(array('' => JText::_('J2STORE_SELECT_OPTION')))->hasOne('Manufacturers')->setRelations(array('fields' => array('key' => 'j2store_manufacturer_id', 'name' => array('company'))))->getHtml();
//vendor
$this->vendors = J2Html::select()->clearState()->type('genericlist')->name($this->form_prefix . '[vendor_id]')->value($this->item->vendor_id)->setPlaceHolders(array('' => JText::_('J2STORE_SELECT_OPTION')))->hasOne('Vendors')->setRelations(array('fields' => array('key' => 'j2store_vendor_id', 'name' => array('first_name', 'last_name'))))->getHtml();
//tax profiles
$this->taxprofiles = J2Html::select()->clearState()->type('genericlist')->name($this->form_prefix . '[taxprofile_id]')->value($this->item->taxprofile_id)->setPlaceHolders(array('' => JText::_('J2STORE_NOT_TAXABLE')))->hasOne('Taxprofiles')->setRelations(array('fields' => array('key' => 'j2store_taxprofile_id', 'name' => 'taxprofile_name')))->getHtml();
}
if ($this->item->j2store_product_id > 0) {
$this->product_filters = F0FTable::getAnInstance('ProductFilter', 'J2StoreTable')->getFiltersByProduct($this->item->j2store_product_id);
} else {
$this->product_filters = array();
}
return true;
}
示例4: callback
/**
* callback.
*
* @return void
*/
public function callback()
{
if ($this->csrfProtection) {
$this->_csrfProtection();
}
try {
// $channelId = $this->input->getUint('channelId');
$session = JFactory::getSession();
$channelId = $session->get('channelId');
// Invalidating
$session->set('channelId', false);
$code = $this->input->getString('code');
$state = $this->input->getString('state');
if (!empty($code)) {
$channel = F0FTable::getAnInstance('Channel', 'AutoTweetTable');
$result = $channel->load($channelId);
if (!$result) {
throw new Exception('LinkedIn Channel failed to load!');
}
$lioauth2ChannelHelper = new LiOAuth2ChannelHelper($channel);
$lioauth2ChannelHelper->authenticate($code, $state);
// Redirect
$url = 'index.php?option=com_autotweet&view=channels&task=edit&id=' . $channelId;
$this->setRedirect($url);
$this->redirect();
}
} catch (Exception $e) {
$logger = AutotweetLogger::getInstance();
$logger->log(JLog::ERROR, $e->getMessage());
throw $e;
}
}
示例5: createCoupon
public function createCoupon($key, $pwd)
{
// Do I have a key/pwd pair?
if (!$key || !$pwd) {
return array('error' => JText::_('COM_AKEEBASUBS_APICOUPONS_INVALID_CREDENTIALS'));
}
$table = $this->getTable();
$table->load(array('key' => $key, 'password' => $pwd));
// Are they valid?
if (!$table->akeebasubs_apicoupon_id || !$table->enabled) {
return array('error' => JText::_('COM_AKEEBASUBS_APICOUPONS_INVALID_CREDENTIALS'));
}
// Do I hit a limit?
if (!$this->performApiChecks($table)) {
return array('error' => JText::_('COM_AKEEBASUBS_APICOUPONS_LIMIT_EXCEEDED'));
}
// If I'm here, I'm clear to go
JLoader::import('joomla.user.helper');
$coupon = F0FTable::getAnInstance('Coupon', 'AkeebasubsTable');
$data['akeebasubs_apicoupon_id'] = $table->akeebasubs_apicoupon_id;
$data['title'] = 'API coupon for: ' . $table->title;
$data['coupon'] = strtoupper(JUserHelper::genRandomPassword(10));
$data['subscriptions'] = $table->subscriptions;
// By default I want the coupon to be single-use
$data['hitslimit'] = 1;
$data['userhits'] = 1;
$data['type'] = $table->type;
$data['value'] = $table->value;
if (!$coupon->save($data)) {
return array('error' => JText::_('COM_AKEEBASUBS_APICOUPONS_COUPON_ERROR'));
}
return array('coupon' => $coupon->coupon);
}
示例6: save
public function save()
{
$task = $this->getTask();
// get the Application Object
$app = JFactory::getApplication();
// get the payment id
$payment_id = $app->input->getInt('extension_id');
// if payment id exists
if ($payment_id) {
$data = $app->input->getArray($_POST);
$paymentdata = array();
$paymentdata['extension_id'] = $payment_id;
$registry = new JRegistry();
$registry->loadArray($data);
$paymentdata['params'] = $registry->toString('JSON');
try {
F0FTable::getAnInstance('Payment', 'J2StoreTable')->save($paymentdata);
} catch (Exception $e) {
$msg = $e->getMessage();
}
switch ($task) {
case 'apply':
parent::apply();
break;
case 'save':
parent::save();
break;
case 'savenew':
parent::savenew();
break;
}
}
}
示例7:
public function &getItem($id = null)
{
$user = JFactory::getUser();
$this->record = F0FTable::getAnInstance('Vendoruser', 'J2StoreTable');
$this->record->load($user->id);
$this->record->products = F0FModel::getTmpInstance('Products', 'J2StoreModel')->vendor_id($this->record->j2store_vendor_id)->enabled(1)->getList();
return $this->record;
}
示例8: deleteproductfiltervalues
function deleteproductfiltervalues()
{
$o_id = $this->input->getInt('productfiltervalue_id');
$productfilter = F0FTable::getAnInstance('filter', 'J2StoreTable');
$json = array();
$json['success']['msg'] = JText::_('J2STORE_PRODUCT_FILTER_VALUE_DELETE_SUCCESS');
if (!$productfilter->delete($o_id)) {
$json['error']['msg'] = JText::_('J2STORE_PRODUCT_FILTER_VALUE_DELETE_ERROR');
}
echo json_encode($json);
JFactory::getApplication()->close();
}
示例9: getRepeatable
public function getRepeatable()
{
$orderinfo = F0FTable::getAnInstance('Orderinfo', 'J2StoreTable');
$orderinfo->load(array('order_id' => $this->item->order_id));
$customer_name = $orderinfo->billing_first_name . ' ' . $orderinfo->billing_last_name;
$html = '';
$html .= $customer_name;
$html .= '<br>';
$html .= '<small>';
$html .= $this->item->user_email;
$html .= '</small>';
return $html;
}
示例10: onBeforeDelete
/**
* Method to delete product optionvalues when product option is deleted
* (non-PHPdoc)
* @see F0FTable::delete()
* @result boolean
*/
protected function onBeforeDelete($oid)
{
$status = true;
//get all the children of product options
$values = F0FModel::getTmpInstance('Filters', 'J2StoreModel')->group_id($oid)->getList();
if (count($values)) {
//loop the productfilters to load and delete the
foreach ($values as $pfilter) {
$filter = F0FTable::getAnInstance('Filter', 'J2StoreTable');
$filter->delete($pfilter->j2store_filter_id);
}
}
return true;
}
示例11: deleteChildren
private function deleteChildren($oid)
{
$status = true;
$model = F0FModel::getTmpInstance('Taxrules', 'J2StoreModel');
$items = $model->taxrate_id($oid)->getList();
$taxrule = F0FTable::getAnInstance('Taxrule', 'J2StoreTable');
if (isset($items) && count($items)) {
foreach ($items as $item) {
if (!$taxrule->delete($item->j2store_taxrule_id)) {
$status = false;
}
}
}
return $status;
}
示例12: getRepeatable
public function getRepeatable()
{
$html = '';
if ($this->item->orderstatus_id != '*') {
$orderstatus = F0FTable::getAnInstance('Orderstatus', 'J2StoreTable');
$orderstatus->load($this->item->orderstatus_id);
$html = '<label class="label">' . JText::_($orderstatus->orderstatus_name);
if (isset($orderstatus->orderstatus_cssclass) && $orderstatus->orderstatus_cssclass) {
$html = '<label class="label ' . $orderstatus->orderstatus_cssclass . '">' . JText::_($orderstatus->orderstatus_name);
}
} else {
$html = '<label class="label label-success">' . JText::_('J2STORE_ALL');
}
$html .= '</label>';
return $html;
}
示例13: testtemplate
public function testtemplate()
{
require_once JPATH_ROOT . '/components/com_akeebasubs/helpers/email.php';
$db = JFactory::getDbo();
$id = $this->input->getInt('akeebasubs_emailtemplate_id', 0);
// No id? What??
if (!$id) {
$this->setRedirect('index.php?option=com_akeebasubs&view=emailtemplates', JText::_('COM_AKEEBASUBS_EMAILTEMPLATES_CHOOSE_TEMPLATE'), 'notice');
$this->redirect();
}
$url = 'index.php?option=com_akeebasubs&view=emailtemplate&id=' . $id;
$template = F0FTable::getAnInstance('Emailtemplate', 'AkeebasubsTable');
$template->load($id);
// Let's grab the first published level
$query = $db->getQuery(true)->select('MIN(akeebasubs_level_id)')->from('#__akeebasubs_levels')->where('enabled = 1');
$level = $db->setQuery($query)->loadResult();
// No level? So what's the point?
if (!$level) {
$this->setRedirect($url, JText::_('COM_AKEEBASUBS_EMAILTEMPLATES_NOENABLEDLEVELS'), 'notice');
$this->redirect();
}
// Let's get a dummy subscription
$sub = F0FTable::getAnInstance('Subscription', 'AkeebasubsTable');
$sub->akeebasubs_subscription_id = 999999;
$sub->user_id = JFactory::getUser()->id;
$sub->akeebasubs_level_id = $level;
$sub->publish_up = date('Y-m-d H:i:s');
$sub->publish_down = date('Y-m-d H:i:s', strtotime('+1 month'));
$sub->notes = 'This is just a dummy subscription for email testing';
$sub->enabled = 1;
$sub->processor = 'Dummy processor';
$sub->processor_key = 'Dummy processor key';
$sub->state = 'C';
$sub->net_amount = 1234.56;
$sub->tax_amount = 123.456;
$sub->gross_amount = 1358.016;
$sub->recurring_amount = 0;
$sub->tax_percent = 10;
$sub->created_on = date('Y-m-d H:i:s');
$mailer = AkeebasubsHelperEmail::getPreloadedMailer($sub, 'plg_akeebasubs_' . $template->key);
$mailer->addRecipient(JFactory::getUser()->email);
if ($mailer->Send()) {
$this->setRedirect($url, JText::_('COM_AKEEBASUBS_EMAILTEMPLATES_TEST_SENT'));
} else {
$this->setRedirect($url, JText::_('COM_AKEEBASUBS_EMAILTEMPLATES_TEST_ERROR'), 'notice');
}
}
示例14: delete
/**
* Method to delete product optionvalues when product option is deleted
* (non-PHPdoc)
* @see F0FTable::delete()
* @result boolean
*/
public function delete($oid = null)
{
$status = true;
//get all the children of product options
$productoptions = F0FModel::getTmpInstance('Productoptionvalues', 'J2StoreModel')->productoption_id($oid)->getList();
if (isset($productoptions) && !empty($productoptions)) {
//loop the productoptions to load and delete the
foreach ($productoptions as $poption) {
$productoption = F0FTable::getAnInstance('Productoptionvalue', 'J2StoreTable');
$productoption->load($poption->j2store_product_optionvalue_id);
if (!$productoption->delete($poption->j2store_product_optionvalue_id)) {
$status = false;
}
}
}
$status = parent::delete($oid);
return $status;
}
示例15: getInput
protected function getInput()
{
$app = JFactory::getApplication();
$id = $app->input->getInt('id');
if ($app->isSite()) {
$id = $app->input->getInt('a_id');
}
$productTable = F0FTable::getAnInstance('Product', 'J2StoreTable');
$productTable->load(array('product_source' => 'com_content', 'product_source_id' => $id));
$product_id = isset($productTable->j2store_product_id) ? $productTable->j2store_product_id : '';
$inputvars = array('task' => 'edit', 'render_toolbar' => '0', 'product_source_id' => $id, 'id' => $product_id, 'product_source' => 'com_content', 'product_source_view' => 'article', 'form_prefix' => 'jform[attribs][j2store]');
$input = new F0FInput($inputvars);
@ob_start();
F0FDispatcher::getTmpInstance('com_j2store', 'product', array('layout' => 'form', 'tmpl' => 'component', 'input' => $input))->dispatch();
$html = ob_get_contents();
ob_end_clean();
return $html;
}