本文整理汇总了PHP中JModelAdmin类的典型用法代码示例。如果您正苦于以下问题:PHP JModelAdmin类的具体用法?PHP JModelAdmin怎么用?PHP JModelAdmin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JModelAdmin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testConstructorAppliesConfiguration
/**
* Test JModelAdmin::__construct
*
* @since 3.4
*
* @return void
*
* @testdox Constructor applies configuration
*/
public function testConstructorAppliesConfiguration()
{
$config = array('event_after_delete' => 'event_after_delete', 'event_after_save' => 'event_after_save', 'event_before_delete' => 'event_before_delete', 'event_before_save' => 'event_before_save', 'event_change_state' => 'event_change_state', 'text_prefix' => 'text_prefix');
$this->object->__construct($config);
// Check if config was applied correctly
foreach ($config as $key => $value) {
if ($key == "text_prefix") {
$this->assertEquals(strtoupper($value), TestReflection::getValue($this->object, $key));
} else {
$this->assertEquals($value, TestReflection::getValue($this->object, $key));
}
}
}
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:22,代码来源:JModelAdminTest.php
示例2: validate
public function validate($form, $data, $group = null)
{
// Prepare the data.
$data["level"] = implode(",", $data["level"]);
return parent::validate($form, $data, $group);
// TODO: Change the autogenerated stub
}
开发者ID:digitalgarage,项目名称:simplelogger,代码行数:7,代码来源:rule.php
示例3: getItem
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
$item->assistance = $item->params['assistance'];
}
return $item;
}
开发者ID:hixbotay,项目名称:executivetransport,代码行数:7,代码来源:transport.php
示例4: save
public function save($form)
{
$canDo = JoaktreeHelper::getActions();
$msg = JText::_('JTAPPS_MESSAGE_NOSAVE');
if ($canDo->get('core.create') || $canDo->get('core.edit')) {
$ret = parent::save($form);
if ($ret) {
$msg = JText::_('JT_MESSAGE_SAVED');
}
// Bind the rules.
if (isset($form['rules'])) {
$actions = array();
$tmp = array();
$tmp[0] = '';
foreach ($data['rules'] as $action => $identities) {
$identities = array_diff($identities, $tmp);
$actions[$action] = $identities;
}
$table = $this->getTable();
$rules = new JRules($actions);
$table->setRules($rules);
}
}
return $msg;
}
开发者ID:Lothurm,项目名称:J3.x,代码行数:25,代码来源:jt_application.php
示例5: getItem
/**
* Method to get a single record.
*
* @param integer The id of the primary key.
*
* @return mixed Object on success, false on failure.
*/
public function getItem($pk = null)
{
//debug::msg('model->getItem');
if ($item = parent::getItem($pk)) {
}
return $item;
}
开发者ID:GGallery,项目名称:MDWEBTV-new,代码行数:14,代码来源:palinsesto.php
示例6: save
function save($data)
{
$courses_csv = implode(',', $data['courses']);
$data['courses'] = $courses_csv;
$return = parent::save($data);
return $return;
}
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:7,代码来源:bundle.php
示例7: getItem
/**
* Method to get a category.
*
* @param integer An optional id of the object to get, otherwise the id from the model state is used.
* @return mixed Category data object on success, false on failure.
* @since 1.6
*/
public function getItem($pk = null)
{
if ($result = parent::getItem($pk)) {
// Prime required properties.
if (empty($result->id)) {
$result->parent_id = $this->getState('category.parent_id');
$result->extension = $this->getState('category.extension');
}
// Convert the metadata field to an array.
$registry = new JRegistry();
$registry->loadJSON($result->metadata);
$result->metadata = $registry->toArray();
// Convert the created and modified dates to local user time for display in the form.
jimport('joomla.utilities.date');
$tz = new DateTimeZone(JFactory::getApplication()->getCfg('offset'));
if (intval($result->created_time)) {
$date = new JDate($result->created_time);
$date->setTimezone($tz);
$result->created_time = $date->toMySQL(true);
} else {
$result->created_time = null;
}
if (intval($result->modified_time)) {
$date = new JDate($result->modified_time);
$date->setTimezone($tz);
$result->modified_time = $date->toMySQL(true);
} else {
$result->modified_time = null;
}
}
return $result;
}
开发者ID:TFToto,项目名称:playjoom-builds,代码行数:39,代码来源:catforplayjoom.php
示例8: save
public function save($data)
{
if (!empty($data['payment_type'])) {
$data['payment_type'] = json_encode($data['payment_type']);
}
return parent::save($data);
}
开发者ID:ngxuanmui,项目名称:hp3,代码行数:7,代码来源:service.php
示例9: prepareTable
protected function prepareTable($table)
{
jimport('joomla.filter.output');
$date = JFactory::getDate();
$user = JFactory::getUser();
parent::prepareTable($table);
}
开发者ID:A-Bush,项目名称:pprod,代码行数:7,代码来源:storeprofile.php
示例10: save
public function save($data)
{
$success = parent::save($data);
if ($success) {
// request option list
$values = JRequest::getVar('joomdoc_option_value', array(), 'default', 'array');
$labels = JRequest::getVar('joomdoc_option_label', array(), 'default', 'array');
// prepare database table
$option = JTable::getInstance('Option', JOOMDOC_TABLE_PREFIX);
/* @var $option JoomDOCTableOption */
$option->field = $this->getState($this->getName() . '.id');
$option->ordering = 0;
$query = $this->getDbo()->getQuery(true);
$query->select('id')->from('#__joomdoc_option')->where('field = ' . (int) $option->field);
$ids = $this->getDbo()->setQuery($query)->loadColumn();
$sid = array();
foreach ($values as $id => $value) {
$option->id = in_array($id, $ids) ? $id : null;
$option->value = $value;
$option->label = $labels[$id];
$option->ordering++;
$option->store();
$sid[] = (int) $option->id;
}
$query->clear()->delete('#__joomdoc_option')->where('field = ' . (int) $option->field);
if ($sid) {
$query->where('id NOT IN (' . implode(', ', $sid) . ')');
}
$this->getDbo()->setQuery($query)->query();
}
return $success;
}
开发者ID:abdullah929,项目名称:bulletin,代码行数:32,代码来源:field.php
示例11: getItem
/**
* Method to get a single comment.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
$item->content_id = (string) $item->content_id . ' - ' . $this->_getContentTitle($item->id);
}
return $item;
}
开发者ID:ManualesJoomla,项目名称:mjcommentsystem,代码行数:14,代码来源:commentform.php
示例12: getItem
public function getItem($pk = null)
{
$item = parent::getItem($pk);
$item->selections = new Registry($item->selections);
$item->selections = $item->selections->toArray();
return $item;
}
开发者ID:b2un0,项目名称:joomla-component-mapx,代码行数:7,代码来源:sitemap.php
示例13: delete
/**
* Override delete method to add the image processing
*/
public function delete(&$pks)
{
// standard joomla delete
$delete = parent::delete($pks);
if (!$delete) {
return false;
}
// delete images
$imageHelper = new CHPanelHelperImage(JComponentHelper::getParams('com_chpanel'));
foreach ($pks as $pk) {
// delete hotel image file
$imageHelper->deleteImage($pk, 'hotels');
// delete hotel gallery images
$query_images = $this->_db->getQuery(true)->select('id')->from('#__chpanel_images')->where("`hotel_id` = " . (int) $pk);
$images_ids = $this->_db->setQuery($query_images)->loadColumn();
if (count($images_ids)) {
// delete images files
foreach ($images_ids as $image_id) {
$imageHelper->deleteImage($image_id, 'images');
}
// db delete images
$query_delete_images = $this->_db->getQuery(true)->delete('#__chpanel_images')->where("`hotel_id` = " . (int) $pk);
$this->_db->setQuery($query_delete_images)->query();
}
}
// delete hotel translations
$this->_db->setQuery("DELETE FROM `#__chpanel_translations` WHERE `hotel_id` IN(" . implode(',', $pks) . ")")->query();
return true;
}
开发者ID:moijafcor,项目名称:CHPanel-Lite,代码行数:32,代码来源:hotel.php
示例14: preprocessForm
/**
* Auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
* @since 3.0
*/
protected function preprocessForm(JForm $form, $data, $group = 'jevents')
{
// Association content items
$app = JFactory::getApplication();
$assoc = false && JLanguageAssociations::isEnabled() && JFactory::getApplication()->isAdmin();
if ($assoc) {
$languages = JLanguageHelper::getLanguages('lang_code');
$addform = new SimpleXMLElement('<form />');
$fields = $addform->addChild('fields');
$fields->addAttribute('name', 'associations');
$fieldset = $fields->addChild('fieldset');
$fieldset->addAttribute('name', 'item_associations');
$fieldset->addAttribute('description', 'COM_JEVENTS_ITEM_ASSOCIATIONS_FIELDSET_DESC');
$add = false;
foreach ($languages as $tag => $language) {
if (empty($data->language) || $tag != $data->language) {
$add = true;
$field = $fieldset->addChild('field');
$field->addAttribute('name', $tag);
$field->addAttribute('type', 'modal_article');
$field->addAttribute('language', $tag);
$field->addAttribute('label', $language->title);
$field->addAttribute('translate_label', 'false');
$field->addAttribute('edit', 'true');
$field->addAttribute('clear', 'true');
}
}
if ($add) {
$form->load($addform, false);
}
}
parent::preprocessForm($form, $data, $group);
}
开发者ID:site4com,项目名称:prometheus,代码行数:41,代码来源:icalevent.php
示例15: array
/**
* Constructor
*
* @since 0.9
*/
function __construct()
{
parent::__construct();
$cid = JRequest::getVar('cid', array(0), '', 'array');
JArrayHelper::toInteger($cid, array(0));
$this->setId($cid[0]);
}
开发者ID:jaanusnurmoja,项目名称:redjoomla,代码行数:12,代码来源:event.php
示例16: cleanCache
/**
* Clean the cache.
* It also cleans the simplecustomrouter plugin cache, as the routes
* configured by this component are used by that plugin.
*
* This method is called when needed from parent models.
*
* @param string $group The cache group
* @param string $client_id The ID of the client
*/
protected function cleanCache($group = null, $client_id = 0)
{
$conf = JFactory::getConfig();
$options = array('defaultgroup' => 'simplecustomrouter', 'cachebase' => $conf->get('cache_path', JPATH_SITE . '/cache'));
$cache = JCache::getInstance('', $options)->clean();
parent::cleanCache($group, $client_id);
}
开发者ID:A-Bush,项目名称:pprod,代码行数:17,代码来源:route.php
示例17: prepareTable
/**
* Prepare and sanitise the table data prior to saving
*
* @param JTable A JTable object
*/
protected function prepareTable($table)
{
if (JFactory::getApplication()->input->get('task') == 'save2copy') {
$table->keywords = JText::_('COM_TAGMETA_COPY_OF') . $table->keywords;
}
parent::prepareTable($table);
}
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:12,代码来源:synonym.php
示例18: getItem
/**
* Method to get a single record.
*
* @param integer The id of the primary key.
*
* @return mixed Object on success, false on failure.
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
//Do any procesing on fields here if needed
}
return $item;
}
开发者ID:emeraldstudio,项目名称:somosmaestros,代码行数:15,代码来源:sliderpublico.php
示例19: save
/**
* The save function
*
* @param array $list - data to save
*
* @return bool
*/
public function save($list)
{
$user = JFactory::getUser();
$item = array();
$item['id'] = null;
$item['mc_id'] = $list['id'];
$item['web_id'] = $list['web_id'];
$item['list_name'] = $list['name'];
$item['date_created'] = $list['date_created'];
$item['email_type_option'] = $list['email_type_option'];
$item['use_awesomebar'] = $list['use_awesomebar'];
$item['default_from_name'] = $list['default_from_name'];
$item['default_from_email'] = $list['default_from_email'];
$item['default_subject'] = $list['default_subject'];
$item['default_language'] = $list['default_language'];
$item['list_rating'] = $list['list_rating'];
$item['subscribe_url_short'] = $list['subscribe_url_short'];
$item['subscribe_url_long'] = $list['subscribe_url_long'];
$item['beamer_address'] = $list['beamer_address'];
$item['visibility'] = $list['visibility'];
$item['created_user_id'] = $user->id;
$item['created_time'] = JFactory::getDate()->toSql();
$item['modified_user_id'] = $user->id;
$item['modified_time'] = JFactory::getDate()->toSql();
$item['access'] = 1;
$item['query_data'] = json_encode($list);
return parent::save($item);
}
开发者ID:fracting,项目名称:cmc,代码行数:35,代码来源:list.php
示例20: __construct
public function __construct($config = array())
{
parent::__construct($config);
$this->app = JFactory::getApplication();
$this->me = KunenaUserHelper::getMyself();
$this->config = KunenaFactory::getConfig();
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:7,代码来源:templates.php
注:本文中的JModelAdmin类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论