本文整理汇总了PHP中unknown::add方法的典型用法代码示例。如果您正苦于以下问题:PHP unknown::add方法的具体用法?PHP unknown::add怎么用?PHP unknown::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unknown
的用法示例。
在下文中一共展示了unknown::add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addQueryFields
/**
* Add the fields to the form for the query mode
*
* @param unknown $form
*/
protected function addQueryFields($form)
{
$options = $this->options;
$form->add('targetPattern');
$form->add('query');
$form->add('maxResults');
$form->add('fields', 'widget_fields', array('label' => 'widget.form.entity.fields.label', 'namespace' => $options['namespace'], 'widget' => $options['widget']));
}
示例2: add
/**
* 添加memcache缓存项
* @see Star_Cache_Interface::add()
*/
public function add($key, $value, $lefttime = 0)
{
if ($lefttime == 0) {
return $this->memcache->add($key, $value, false);
} else {
return $this->memcache->add($key, $value, false, $lefttime);
}
}
示例3:
/**
*
*
* @param $values
* @return unknown
*/
function save_cat($values)
{
if ($values['access']) {
$values['access'] = 'private';
} else {
$values['access'] = 'public';
}
if (isset($values['id']) && $values['id'] != 0) {
return $this->cats->edit($values);
} else {
return $this->cats->add($values);
}
}
示例4: addDot
/**
* Add dot
*
* @param \AdminBundle\Entity\Dots $dot
*
* @return Product
*/
public function addDot(Dot $dot)
{
$dot->addProduct($this);
$this->dots->add($dot);
}
示例5: addQueryFields
/**
* Add the fields to the form for the query mode.
*
* @param unknown $form
*/
protected function addQueryFields($form)
{
$options = $this->options;
$form->add('query');
$form->add('fields', 'widget_fields', ['label' => 'widget.form.entity.fields.label', 'namespace' => $options['namespace'], 'widget' => $options['widget']]);
}
示例6: index
/**
* Render index form for ACLs
*
* @return null
*/
function index()
{
$acl_app = phpgw::get_var('acl_app', 'string');
$start = phpgw::get_var('start', 'int');
$query = phpgw::get_var('query', 'string');
$s_groups = phpgw::get_var('s_groups', 'int');
$s_users = phpgw::get_var('s_users', 'int');
$owner = phpgw::get_var('owner', 'int');
$acl_app_not_passed = false;
if (!$acl_app) {
$acl_app = 'preferences';
$acl_app_not_passed = true;
} else {
$GLOBALS['phpgw']->translation->add_app($acl_app);
}
$GLOBALS['phpgw_info']['flags']['currentapp'] = $acl_app;
if ($acl_app_not_passed) {
if (is_object($GLOBALS['phpgw']->log)) {
$GLOBALS['phpgw']->log->message(array('text' => 'F-BadmenuactionVariable, failed to pass acl_app.', 'line' => __LINE__, 'file' => __FILE__));
$GLOBALS['phpgw']->log->commit();
}
}
if (isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) && $GLOBALS['phpgw_info']['server']['deny_user_grants_access'] && !isset($GLOBALS['phpgw_info']['user']['apps']['admin'])) {
echo '<center><b>' . lang('Access not permitted') . '</b></center>';
$GLOBALS['phpgw']->common->phpgw_exit(true);
}
if (!isset($GLOBALS['phpgw_info']['user']['apps']['admin']) || !$owner) {
$owner = $GLOBALS['phpgw_info']['user']['account_id'];
}
$acct = createObject('phpgwapi.accounts', $owner);
$groups = $acct->get_list('groups');
$users = $acct->get_list('accounts');
$owner_name = $acct->id2name($owner);
// get owner name for title
$is_group = $acct->get_type($owner);
if ($is_group == 'g') {
$owner_name = lang('Group (%1)', $owner_name);
}
unset($acct);
$this->acl = createObject('phpgwapi.acl', (int) $owner);
$errors = '';
if (phpgw::get_var('submit', 'bool', 'POST')) {
$processed = $_POST['processed'];
$to_remove = unserialize($processed);
foreach ($to_remove as $entry) {
$this->acl->delete($acl_app, (int) $entry);
}
/* Group records */
$group_variable = phpgw::get_var("g_{$acl_app}", 'string', 'POST');
if (!$group_variable) {
$group_variable = array();
}
$totalacl = array();
foreach ($group_variable as $rowinfo) {
list($group_id, $rights) = explode('_', $rowinfo, 2);
$totalacl[(int) $group_id] += (int) $rights;
}
/* User records */
$user_variable = phpgw::get_var("u_{$acl_app}", 'string', 'POST');
if (!$user_variable) {
$user_variable = array();
}
foreach ($user_variable as $rowinfo) {
list($user_id, $rights) = explode('_', $rowinfo, 2);
$totalacl[(int) $user_id] += (int) $rights;
}
// Update all the ACLs at once
foreach ($totalacl as $id => $rights) {
if ($is_group) {
/* Don't allow group-grants to grant private */
$rights &= ~phpgwapi_acl::PRIV;
}
$this->acl->add($acl_app, $id, $rights);
}
if ($this->acl->save_repository('preferences')) {
$errors = lang('Grants have been updated');
} else {
$errors = lang('ERROR: Grants have not been updated');
}
}
$processed = array();
$total = 0;
$maxm = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
$totalentries = count($groups) + count($users);
if ($totalentries < $maxm) {
$maxm = $totalentries;
}
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('%1 - Preferences', lang($acl_app)) . ' - ' . lang('acl') . ": {$owner_name}";
$GLOBALS['phpgw']->common->phpgw_header();
echo parse_navbar();
$this->template->set_root($GLOBALS['phpgw']->common->get_tpl_dir($acl_app));
$templates = array('preferences' => 'preference_acl.tpl', 'row_colspan' => 'preference_colspan.tpl', 'acl_row' => 'preference_acl_row.tpl');
$this->template->set_file($templates);
$common_hidden_vars = <<<HTML
\t\t\t\t<input type="hidden" name="s_groups" value="{$s_groups}">
//.........这里部分代码省略.........
示例7: addProduct
/**
* Add product
*
* @param \AdminBundle\Entity\Product $product
*
* @return Dot
*/
public function addProduct(Product $product)
{
if (!$this->products->contains($product)) {
$this->products->add($product);
}
}