本文整理汇总了PHP中self::find方法的典型用法代码示例。如果您正苦于以下问题:PHP self::find方法的具体用法?PHP self::find怎么用?PHP self::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTabNameForItem
public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
$env = new self();
$found_env = $env->find();
$nb = count($found_env);
return self::createTabEntry(self::getTypeName($nb), $nb);
}
示例2: getHistory
static function getHistory($tickets_id, $full_history = false)
{
global $CFG_GLPI;
$filter_groups_id = array();
if ($_SESSION['plugins']['escalade']['config']['use_filter_assign_group']) {
$groups_groups = new PluginEscaladeGroup_Group();
$filter_groups_id = $groups_groups->getGroups($tickets_id);
$use_filter_assign_group = true;
} else {
$use_filter_assign_group = false;
}
$plugin_dir = $full_history ? ".." : "../plugins/escalade";
//get all line for this ticket
$group = new Group();
$history = new self();
$found = $history->find("tickets_id = {$tickets_id}", "date_mod DESC");
$nb_histories = count($found);
//remove first line (current assign)
$first_group = array_shift($found);
if ($full_history) {
//show 1st group
echo "<div class='escalade_active'>";
echo " <img src='" . $CFG_GLPI['root_doc'] . "/pics/group.png' /> ";
if ($group->getFromDB($first_group['groups_id'])) {
echo $group->getLink(true);
}
echo "</div>";
}
echo "<div class='escalade'>";
//parse all lines
$i = 0;
foreach ($found as $key => $hline) {
echo "<div class='escalade_history'>";
if (!$use_filter_assign_group || isset($filter_groups_id[$hline['groups_id']])) {
//up link and image
echo "<a href='{$plugin_dir}/front/climb_group.php?tickets_id=" . $tickets_id . "&groups_id=" . $hline['groups_id'];
if ($full_history) {
echo "&full_history=true";
}
echo "' title='" . __("Reassign the ticket to group", "escalade") . "' class='up_a'></a>";
} else {
echo " ";
}
//group link
echo " <img src='" . $CFG_GLPI['root_doc'] . "/pics/group.png' /> ";
if ($group->getFromDB($hline['groups_id'])) {
echo self::showGroupLink($group, $full_history);
}
echo "</div>";
$i++;
if ($i == self::HISTORY_LIMIT && !$full_history) {
break;
}
}
//In case there are more than 10 group changes, a popup can display historical
if ($nb_histories - 1 > self::HISTORY_LIMIT && !$full_history) {
echo "<a href='#' onclick='var w=window.open(\"" . $plugin_dir . "/front/popup_histories.php?tickets_id=" . $tickets_id . "\" ,\"\", \"height=500, width=250, top=100, left=100, scrollbars=yes\" ); " . "w.focus();' title='" . __("View full history", "escalade") . "'>...</a>";
}
echo "</div>";
}
示例3: save
public function save()
{
$value_changed = $this->getValue() != $this->getOrigValue();
if (stripos($this->getValue(), "image/png;base64") !== false) {
$data = substr($this->getValue(), strpos($this->getValue(), ",") + 1);
$data = str_replace(' ', '+', $data);
$data = base64_decode($data);
$ext = $this->getCode() == "favicon" ? ".ico" : ".png";
$filename = $this->getCode() . $ext;
$filepath = Core_Model_Directory::getBasePathTo("images/default");
if (!is_dir($filepath)) {
mkdir($filepath, 0777, true);
}
if (!is_writable($filepath)) {
throw new Exception($this->_("The folder /images/default is not writable."));
}
file_put_contents("{$filepath}/{$filename}", $data);
$this->setValue("/images/default/{$this->getCode()}.{$ext}");
}
parent::save();
if ($this->getCode() == "system_timezone" && $value_changed) {
$config = new self();
$config->find("system_territory", "code");
$value = $this->getValue();
$territories = Zend_Registry::get("Zend_Locale")->getTranslationList('TerritoryToTimezone');
$territory = $value && !empty($territories[$value]) ? $territories[$value] : null;
$data = array("code" => "system_territory", "value" => $territory);
$config->addData($data)->save();
}
}
示例4: displayTabContentForItem
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
{
return;
$profile = new Profile();
$found_profiles = $profile->find("`interface` = 'central'");
$tab_profile = new self();
$found_tab_profiles = $tab_profile->find("`plugin_custom_tabs_id` = " . $item->getID());
echo "<form method='POST' action='tabprofile.form.php' />";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4'>" . __("Visibility") . "</th></tr>";
$odd = 0;
foreach ($found_profiles as $profiles_id => $profile_fields) {
if ($odd % 2 === 0) {
echo "<tr>";
}
echo "<td>" . $profile_fields['name'] . "</td>";
echo "<td>";
Dropdown::showYesNo("tab_profile[{$profiles_id}]", 0);
echo "</td>";
if ($odd % 2 === 1) {
echo "</tr>";
}
$odd++;
}
if ($odd % 2 === 0) {
echo "</tr>";
}
echo "<tr><td colspan='4'><div class='center'>";
echo "<input type='submit' name='update' value=\"" . _sx('button', 'Post') . "\" class='submit'>";
echo "</div></td></tr>";
echo "</table>";
Html::closeForm();
return true;
}
示例5: getAreaByStateId
public static function getAreaByStateId($stateId)
{
$stateModel = new self();
$state = $stateModel->find($stateId);
if ($state) {
return self::area($state->name);
}
return 'west';
}
示例6: getAndroidSenderId
public static function getAndroidSenderId()
{
if (is_null(self::$_android_sender_id)) {
$certificat = new self();
$certificat->find('android_sender_id', 'type');
self::$_android_sender_id = $certificat->getPath();
}
return self::$_android_sender_id;
}
示例7: countForLock
static function countForLock(CommonGLPI $item)
{
$pfLock = new self();
$a_data = current($pfLock->find("`tablename`='" . $item->getTable() . "'\n AND `items_id`='" . $item->getID() . "'", "", 1));
if (count($a_data) == '0') {
return 0;
} else {
return count(importArrayFromDB($a_data['tablefields']));
}
}
示例8: array
static function getTag_items($id_glpi_obj, $itemtype)
{
$IDs = array();
//init
$tagitems = new self();
foreach ($tagitems->find("itemtype = '{$itemtype}' AND items_id = {$id_glpi_obj}") as $tagitem) {
$IDs[] = $tagitem["plugin_tag_tags_id"];
}
return $IDs;
}
示例9: updateProfile
static function updateProfile($input)
{
$fields_profile = new self();
foreach ($input['rights'] as $profiles_id => $right) {
$found = $fields_profile->find("`profiles_id` = '{$profiles_id}'\n AND `plugin_fields_containers_id` = '" . $input['plugin_fields_containers_id'] . "'");
$first_found = array_shift($found);
$fields_profile->update(array('id' => $first_found['id'], 'profiles_id' => $profiles_id, 'plugin_fields_containers_id' => $input['plugin_fields_containers_id'], 'right' => $right));
}
return true;
}
示例10: getTabNameForItem
public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
switch ($item->getType()) {
case "PluginFormcreatorForm":
$env = new self();
$found_env = $env->find('plugin_formcreator_forms_id = ' . $item->getID());
$nb = count($found_env);
return self::createTabEntry(self::getTypeName($nb), $nb);
}
return '';
}
示例11: self
/**
* Return the DAO object containing to the default row of
* civicrm_mail_settings and cache it for further calls
*
* @return object DAO with the default mail settings set
*/
static function &defaultDAO()
{
static $dao = NULL;
if (!$dao) {
$dao = new self();
$dao->is_default = 1;
$dao->domain_id = CRM_Core_Config::domainID();
$dao->find(TRUE);
}
return $dao;
}
示例12: cleanup
static function cleanup($profile_list)
{
$subs = new self();
$subs->profile_tag_id = $profile_list->id;
$subs->find();
while ($subs->fetch()) {
$profile = Profile::getKV('id', $subs->profile_id);
Event::handle('StartUnsubscribePeopletag', array($profile_list, $profile));
// Delete anyway
$subs->delete();
Event::handle('StartUnsubscribePeopletag', array($profile_list, $profile));
}
}
示例13: defaultDAO
/**
* Return the DAO object containing to the default row of
* civicrm_mail_settings and cache it for further calls
*
* @param bool $reset
*
* @return CRM_Core_BAO_MailSettings
* DAO with the default mail settings set
*/
public static function defaultDAO($reset = FALSE)
{
static $mailSettings = array();
$domainID = CRM_Core_Config::domainID();
if (empty($mailSettings[$domainID]) || $reset) {
$dao = new self();
$dao->is_default = 1;
$dao->domain_id = $domainID;
$dao->find(TRUE);
$mailSettings[$domainID] = $dao;
}
return $mailSettings[$domainID];
}
示例14: getTabNameForItem
/**
* Return the name of the tab for item including forms like the config page
*
* @param CommonGLPI $item Instance of a CommonGLPI Item (The Config Item)
* @param integer $withtemplate
*
* @return String Name to be displayed
*/
public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
switch ($item->getType()) {
case "PluginFormcreatorForm":
$number = 0;
$section = new PluginFormcreatorSection();
$found = $section->find('plugin_formcreator_forms_id = ' . $item->getID());
$tab_section = array();
foreach ($found as $section_item) {
$tab_section[] = $section_item['id'];
}
if (!empty($tab_section)) {
$object = new self();
$found = $object->find('plugin_formcreator_sections_id IN (' . implode(', ', $tab_section) . ')');
$number = count($found);
}
return self::createTabEntry(self::getTypeName($number), $number);
}
return '';
}
示例15: checkVacancyPermission
/**
* Based on vacancy ID and/or given permission return list of permission
* that the logged in user have or return TRUE/FALSE if the loggedin user
* has permission in the given permission list $checkPermissions respectively
*
* @param int $vacancyID vacancy ID to retrieve its permission for loggedin user
* @param array $checkPermissions list of permission to check if loggedin user has any of the permission for given vacancy
* whose id = $vacancyID
*
* @return boolean|array
* @access public
* @static
*/
public static function checkVacancyPermission($vacancyID, $checkPermissions = array(), $defaultPermissions = array())
{
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
$vacancyPermissions = array();
$dao = new self();
$dao->vacancy_id = $vacancyID;
$dao->contact_id = $userID;
$dao->find();
if (CRM_Core_Permission::check('administer CiviCRM')) {
if (count($checkPermissions) && in_array('administer CiviCRM', $checkPermissions)) {
return TRUE;
} else {
$vacancyPermissions[] = 'administer CiviCRM';
}
}
if (empty($defaultPermissions)) {
$defaultPermissions[] = $checkPermissions;
}
if (count($defaultPermissions) && CRM_Core_Permission::check($defaultPermissions)) {
return TRUE;
}
while ($dao->fetch()) {
if (count($checkPermissions)) {
if (in_array($dao->permission, $checkPermissions)) {
return TRUE;
}
} else {
$vacancyPermissions[] = $dao->permission;
}
}
if (count($checkPermissions)) {
return FALSE;
}
return $vacancyPermissions;
}