本文整理匯總了PHP中Backend\Core\Engine\Model::insertExtra方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model::insertExtra方法的具體用法?PHP Model::insertExtra怎麽用?PHP Model::insertExtra使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Backend\Core\Engine\Model
的用法示例。
在下文中一共展示了Model::insertExtra方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: insert
/**
* Insert an item in the database
*
* @param array $item
* @return int
*/
public static function insert(array $item)
{
$item['created_on'] = BackendModel::getUTCDate();
$item['edited_on'] = BackendModel::getUTCDate();
$db = BackendModel::get('database');
// insert extra
$item['extra_id'] = BackendModel::insertExtra('widget', 'Instagram', 'InstagramFeed');
$item['id'] = (int) $db->insert('instagram_users', $item);
// update extra (item id is now known)
BackendModel::updateExtra($item['extra_id'], 'data', array('id' => $item['id'], 'extra_label' => \SpoonFilter::ucfirst(Language::lbl('Instagram', 'InstagramFeed')) . ': ' . $item['username'], 'edit_url' => BackendModel::createURLForAction('Edit', 'Instagram', null) . '&id=' . $item['id']));
return $item['id'];
}
示例2: insert
/**
* Add a new item.
*
* @param array $item The data to insert.
* @return int
*/
public static function insert(array $item)
{
// insert extra
$item['extra_id'] = BackendModel::insertExtra('widget', 'ContentBlocks', 'Detail');
$item['revision_id'] = BackendModel::get('database')->insert('content_blocks', $item);
// update data for the extra
BackendModel::updateExtra($item['extra_id'], 'data', array('id' => $item['id'], 'extra_label' => $item['title'], 'language' => $item['language'], 'edit_url' => BackendModel::createURLForAction('Edit', 'ContentBlocks', $item['language']) . '&id=' . $item['id']));
return $item['revision_id'];
}
示例3: insertCategory
/**
* Insert a category in the database
*
* @param array $item
* @return int
*/
public static function insertCategory(array $item)
{
// insert extra
$item['extra_id'] = BackendModel::insertExtra('widget', 'Catalog', 'Category');
$item['created_on'] = BackendModel::getUTCDate();
$item['edited_on'] = BackendModel::getUTCDate();
$item['id'] = BackendModel::getContainer()->get('database')->insert('catalog_categories', $item);
// update data for the extra
BackendModel::updateExtra($item['extra_id'], 'data', array('id' => $item['id'], 'extra_label' => BL::getLabel('Category') . ' ' . $item['title'], 'language' => $item['language'], 'edit_url' => BackendModel::createURLForAction('EditCategory', 'Catalog', $item['language']) . '&id=' . $item['id']));
return $item['id'];
}
示例4: insert
/**
* Add a new item.
*
* @param array $item The data to insert.
*
* @return int
*
* @deprecated use doctrine instead
*/
public static function insert(array $item)
{
trigger_error('Backend\\Modules\\ContentBlocks\\Engine is deprecated.
Switch to doctrine instead.', E_USER_DEPRECATED);
// insert extra
$item['extra_id'] = BackendModel::insertExtra(ModuleExtraType::widget(), 'ContentBlocks', 'Detail');
$item['revision_id'] = BackendModel::get('database')->insert('content_blocks', $item);
// update data for the extra
BackendModel::updateExtra($item['extra_id'], 'data', array('id' => $item['id'], 'extra_label' => $item['title'], 'language' => $item['language'], 'edit_url' => BackendModel::createURLForAction('Edit', 'ContentBlocks', $item['language']) . '&id=' . $item['id'], 'custom_template' => $item['template']));
return $item['revision_id'];
}
示例5: insertGallery
/**
* Add a new gallery.
*
* @return int
* @param array $item The data to insert.
*/
public static function insertGallery(array $item)
{
$item['id'] = BackendModel::getContainer()->get('database')->insert('slideshow_galleries', $item);
// build extra
$item['extra_id'] = BackendModel::insertExtra('widget', 'Slideshow', 'Slideshow', 'Slideshow', array('extra_label' => $item['title'], 'gallery_id' => $item['id'], 'language' => BL::getWorkingLanguage()), false, '800' . $item['id']);
// update gallery with extra id
self::updateGallery($item);
return $item['id'];
}
示例6: insert
/**
* Add a new item.
*
* @param array $values The data to insert.
*
* @return int
*/
public static function insert(array $values)
{
// define form id
$formId = BackendModel::getContainer()->get('database')->insert('forms', $values);
// insert extra
BackendModel::insertExtra(ModuleExtraType::widget(), 'FormBuilder', 'Form', 'FormBuilder', array('id' => $formId, 'extra_label' => $values['name'], 'language' => $values['language'], 'edit_url' => BackendModel::createURLForAction('Edit') . '&id=' . $formId), false, '400' . $formId);
return $formId;
}
示例7: insertCategory
/**
* Insert a category in the database
*
* @param array $item
* @return int
*/
public static function insertCategory(array $item)
{
$item['created_on'] = BackendModel::getUTCDate();
$item['edited_on'] = BackendModel::getUTCDate();
$categoryId = BackendModel::get('database')->insert('blocks_categories', $item);
$extraId = BackendModel::insertExtra('widget', 'Blocks', 'Category', 'Blocks', array('id' => $categoryId, 'extra_label' => 'Block ' . Language::getLabel('Category') . ' ' . $item['title'], 'language' => $item['language'], 'edit_url' => BackendModel::createURLForAction('EditCategory') . '&id=' . $categoryId), false, '400' . $categoryId);
BackendModel::get('database')->update('blocks_categories', array('extra_id' => $extraId), 'id = ?', (int) $categoryId);
return $categoryId;
}
示例8: insert
/**
* Insert an item
*
* @param array $item The data of the record to insert.
*
* @return int
*/
public static function insert($item)
{
$db = BackendModel::getContainer()->get('database');
// insert extra
$item['extra_id'] = BackendModel::insertExtra(ModuleExtraType::widget(), 'Location');
// insert new location
$item['created_on'] = $item['edited_on'] = BackendModel::getUTCDate();
$item['id'] = $db->insert('location', $item);
// update extra (item id is now known)
BackendModel::updateExtra($item['extra_id'], 'data', array('id' => $item['id'], 'extra_label' => \SpoonFilter::ucfirst(BL::lbl('Location', 'Core')) . ': ' . $item['title'], 'language' => $item['language'], 'edit_url' => BackendModel::createURLForAction('Edit') . '&id=' . $item['id']));
return $item['id'];
}
示例9: getNewExtraId
/**
* @return int
*/
private function getNewExtraId()
{
return Model::insertExtra(ModuleExtraType::widget(), 'ContentBlocks', 'Detail');
}
示例10: insertCategory
/**
* Insert a category in the database
*
* @param array $item
* @param array $meta The metadata for the category to insert.
* @return int
*/
public static function insertCategory(array $item, $meta = null)
{
$db = BackendModel::get('database');
// insert the meta if possible
if ($meta !== null) {
$item['meta_id'] = $db->insert('meta', $meta);
}
// insert extra
$item['extra_id'] = BackendModel::insertExtra('widget', 'Faq', 'CategoryList');
$item['id'] = $db->insert('faq_categories', $item);
// update extra (item id is now known)
BackendModel::updateExtra($item['extra_id'], 'data', array('id' => $item['id'], 'extra_label' => \SpoonFilter::ucfirst(BL::lbl('Category', 'Faq')) . ': ' . $item['title'], 'language' => $item['language'], 'edit_url' => BackendModel::createURLForAction('EditCategory', 'Faq', $item['language']) . '&id=' . $item['id']));
BackendModel::invalidateFrontendCache('Faq', BL::getWorkingLanguage());
return $item['id'];
}