本文整理汇总了PHP中CContact::canCreate方法的典型用法代码示例。如果您正苦于以下问题:PHP CContact::canCreate方法的具体用法?PHP CContact::canCreate怎么用?PHP CContact::canCreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContact
的用法示例。
在下文中一共展示了CContact::canCreate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
$company_id = (int) w2PgetParam($_GET, 'company_id', 0);
$tab = $AppUI->processIntState('CompVwTab', $_GET, 'tab', 0);
$company = new CCompany();
if (!$company->load($company_id)) {
$AppUI->redirect(ACCESS_DENIED);
}
$canEdit = $company->canEdit();
$canDelete = $company->canDelete();
$deletable = $canDelete;
//TODO: this should be removed once the $deletable variable is removed
$contact = new CContact();
$canCreateContacts = $contact->canCreate();
// setup the title block
$titleBlock = new w2p_Theme_TitleBlock('View Company', 'icon.png', $m);
$titleBlock->addCrumb('?m=' . $m, $m . ' list');
if ($canCreateContacts) {
$titleBlock->addButton('New contact', '?m=contacts&a=addedit&company_id=' . $company_id);
}
if ($canEdit) {
if ($AppUI->isActiveModule('departments')) {
$titleBlock->addButton('New department', '?m=departments&a=addedit&company_id=' . $company_id);
}
$titleBlock->addButton('New project', '?m=projects&a=addedit&company_id=' . $company_id);
$titleBlock->addCrumb('?m=companies&a=addedit&company_id=' . $company_id, 'edit this company');
if ($canDelete && $deletable) {
$titleBlock->addCrumbDelete('delete company', $deletable, $msg);
}
示例2: die
<?php
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
$tab = $AppUI->processIntState('ContactsIdxTab', $_GET, 'tab', 0);
$searchString = w2PgetParam($_POST, 'search_string', '');
$contact = new CContact();
$canCreate = $contact->canCreate();
$canAccess = $contact->canAccess();
if (!$canAccess) {
$AppUI->redirect(ACCESS_DENIED);
}
$titleBlock = new w2p_Theme_TitleBlock('Contacts', 'icon.png', $m);
$titleBlock->addCell('<a href="./index.php?m=contacts&tab=0">' . $AppUI->_('Reset search') . '</a>');
$titleBlock->addCell('<form action="index.php?m=contacts&tab=27" method="post" accept-charset="utf-8" name="searchform">' . '<input type="text" class="text" name="search_string" value="' . $searchString . '" /></form>');
$titleBlock->addCell($AppUI->_('Search') . ':');
if ($canCreate) {
$titleBlock->addButton('New contact', '?m=contacts&a=addedit');
$titleBlock->addCrumb('?m=contacts&a=csvexport&suppressHeaders=1', 'CSV Download');
$titleBlock->addCrumb('?m=contacts&a=vcardimport&dialog=0', 'Import vCard');
}
$titleBlock->show();
$tabBox = new CTabBox('?m=contacts', W2P_BASE_DIR . '/modules/contacts/', $tab);
$tabBox->add('vw_idx_contacts', $AppUI->_('Recently Updated'));
for ($c = 65; $c < 91; $c++) {
$tabBox->add('vw_idx_contacts', $AppUI->_(chr($c)));
}
$tabBox->add('vw_idx_contacts', $AppUI->_('All Contacts'));
$tabBox->show();
// TODO: Check to see that the Edit function is separated.
示例3: die
<?php
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
// @todo convert to template
$object_id = (int) w2PgetParam($_GET, 'contact_id', 0);
$company_id = (int) w2PgetParam($_GET, 'company_id', 0);
$dept_id = (int) w2PgetParam($_GET, 'dept_id', 0);
$object = new CContact();
$object->setId($object_id);
$canAddEdit = $object->canAddEdit();
$canAuthor = $object->canCreate();
$canEdit = $object->canEdit();
$canDelete = $object->canDelete();
if (!$canAddEdit) {
$AppUI->redirect(ACCESS_DENIED);
}
// load the record data
$obj = $AppUI->restoreObject();
if ($obj) {
$object = $obj;
$object_id = $object->getId();
} else {
$object->load($object_id);
}
if (!$object && $object_id > 0) {
$AppUI->setMsg('Contact');
$AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
$AppUI->redirect('m=' . $m);
}