当前位置: 首页>>代码示例>>PHP>>正文


PHP Toolbox::strtolower方法代码示例

本文整理汇总了PHP中Toolbox::strtolower方法的典型用法代码示例。如果您正苦于以下问题:PHP Toolbox::strtolower方法的具体用法?PHP Toolbox::strtolower怎么用?PHP Toolbox::strtolower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Toolbox的用法示例。


在下文中一共展示了Toolbox::strtolower方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDatasForTemplate

 function getDatasForTemplate($event, $options = array())
 {
     global $CFG_GLPI;
     if ($event == 'AlertNotValidatedTypology') {
         $this->datas['##typology.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
         $this->datas['##lang.typology.entity##'] = __('Entity');
         $this->datas['##typology.action##'] = __('Elements not match with the typology', 'typology');
         $this->datas['##lang.typology.name##'] = PluginTypologyTypology::getTypeName(1);
         $this->datas['##lang.typology.itemtype##'] = __('Type');
         $this->datas['##lang.typology.items_id##'] = __('Name');
         $this->datas['##lang.typology.error##'] = __('Error');
         $this->datas['##lang.typology.url##'] = __('Link to the typology', 'typology');
         $this->datas['##lang.typology.itemurl##'] = __('Link to the element', 'typology');
         $this->datas['##lang.typology.itemuser##'] = __('User');
         $this->datas['##lang.typology.itemlocation##'] = __('Location');
         foreach ($options['items'] as $id => $item) {
             $tmp = array();
             $tmp['##typology.name##'] = $item['name'];
             $itemtype = new $item['itemtype']();
             $itemtype->getFromDB($item["items_id"]);
             $tmp['##typology.itemtype##'] = $itemtype->getTypeName();
             $tmp['##typology.items_id##'] = $itemtype->getName();
             $tmp['##typology.error##'] = PluginTypologyTypology_Item::displayErrors($item['error'], false);
             $tmp['##typology.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=plugin_typology_" . $item['plugin_typology_typologies_id']);
             $tmp['##typology.itemurl##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=" . Toolbox::strtolower($item['itemtype']) . "_" . $item["items_id"]);
             $tmp['##typology.itemuser##'] = getUserName($itemtype->fields["users_id"]);
             $tmp['##typology.itemlocation##'] = Dropdown::getDropdownName("glpi_locations", $itemtype->fields['locations_id']);
             $this->datas['typologyitems'][] = $tmp;
         }
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:31,代码来源:notificationtargettypology.class.php

示例2: prepareInputForAdd

 /**
  * @see CommonDBTM::prepareInputForAdd()
  **/
 function prepareInputForAdd($input)
 {
     //LDAP parameters MUST be in lower case
     //because the are retieved in lower case  from the directory
     $input["value"] = Toolbox::strtolower($input["value"]);
     return $input;
 }
开发者ID:stweil,项目名称:glpi,代码行数:10,代码来源:rulerightparameter.class.php

示例3: getFromLDAPGroupVirtual

 /**
  * Function that try to load from LDAP the user membership
  * by searching in the attribute of the User
  *
  * @param $ldap_connection    ldap connection descriptor
  * @param $ldap_method        LDAP method
  * @param $userdn             Basedn of the user
  * @param $login              User login
  *
  * @return String : basedn of the user / false if not founded
  **/
 private function getFromLDAPGroupVirtual($ldap_connection, $ldap_method, $userdn, $login)
 {
     global $DB;
     // Search in DB the ldap_field we need to search for in LDAP
     $query = "SELECT DISTINCT `ldap_field`\n                FROM `glpi_groups`\n                WHERE `ldap_field` != ''\n                ORDER BY `ldap_field`";
     $group_fields = array();
     foreach ($DB->request($query) as $data) {
         $group_fields[] = Toolbox::strtolower($data["ldap_field"]);
     }
     if (count($group_fields)) {
         //Need to sort the array because edirectory don't like it!
         sort($group_fields);
         // If the groups must be retrieve from the ldap user object
         $sr = @ldap_read($ldap_connection, $userdn, "objectClass=*", $group_fields);
         $v = AuthLDAP::get_entries_clean($ldap_connection, $sr);
         for ($i = 0; $i < count($v['count']); $i++) {
             //Try to find is DN in present and needed: if yes, then extract only the OU from it
             if (($ldap_method["group_field"] == 'dn' || in_array('ou', $group_fields)) && isset($v[$i]['dn'])) {
                 $v[$i]['ou'] = array();
                 for ($tmp = $v[$i]['dn']; count($tmptab = explode(',', $tmp, 2)) == 2; $tmp = $tmptab[1]) {
                     $v[$i]['ou'][] = $tmptab[1];
                 }
                 // Search in DB for group with ldap_group_dn
                 if ($ldap_method["group_field"] == 'dn' && count($v[$i]['ou']) > 0) {
                     $query = "SELECT `id`\n                            FROM `glpi_groups`\n                            WHERE `ldap_group_dn`\n                                       IN ('" . implode("', '", Toolbox::addslashes_deep($v[$i]['ou'])) . "')";
                     foreach ($DB->request($query) as $group) {
                         $this->fields["_groups"][] = $group['id'];
                     }
                 }
                 // searching with ldap_field='OU' and ldap_value is also possible
                 $v[$i]['ou']['count'] = count($v[$i]['ou']);
             }
             // For each attribute retrieve from LDAP, search in the DB
             foreach ($group_fields as $field) {
                 if (isset($v[$i][$field]) && isset($v[$i][$field]['count']) && $v[$i][$field]['count'] > 0) {
                     unset($v[$i][$field]['count']);
                     $query = "SELECT `id`\n                            FROM `glpi_groups`\n                            WHERE `ldap_field` = '{$field}'\n                                  AND `ldap_value`\n                                       IN ('" . implode("', '", Toolbox::addslashes_deep($v[$i][$field])) . "')";
                     foreach ($DB->request($query) as $group) {
                         $this->fields["_groups"][] = $group['id'];
                     }
                 }
             }
         }
         // for each ldapresult
     }
     // count($group_fields)
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:58,代码来源:user.class.php

示例4: getFieldsToLookFor

 /**
  * Get all the fields needed to perform the rule
  *
  * @see RuleCollection::getFieldsToLookFor()
  **/
 function getFieldsToLookFor()
 {
     global $DB;
     $params = array();
     $sql = "SELECT DISTINCT `value`\n              FROM `glpi_rules`,\n                   `glpi_rulecriterias`,\n                   `glpi_rulerightparameters`\n              WHERE `glpi_rules`.`sub_type` = 'RuleRight'\n                    AND `glpi_rulecriterias`.`rules_id` = `glpi_rules`.`id`\n                    AND `glpi_rulecriterias`.`criteria` = `glpi_rulerightparameters`.`value`";
     $result = $DB->query($sql);
     while ($param = $DB->fetch_assoc($result)) {
         //Dn is alwsays retreived from ldap : don't need to ask for it !
         if ($param["value"] != "dn") {
             $params[] = Toolbox::strtolower($param["value"]);
         }
     }
     return $params;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:19,代码来源:rulerightcollection.class.php

示例5: getHeaders

 /**
  * This function is use full to Get Header info from particular mail
  *
  * @param $mid               = Mail Id of a Mailbox
  *
  * @return Return Associative array with following keys
  * subject   => Subject of Mail
  * to        => To Address of that mail
  * toOth     => Other To address of mail
  * toNameOth => To Name of Mail
  * from      => From address of mail
  * fromName  => Form Name of Mail
  **/
 function getHeaders($mid)
 {
     // Get Header info
     $mail_header = imap_header($this->marubox, $mid);
     $sender = $mail_header->from[0];
     $to = $mail_header->to[0];
     $date = date("Y-m-d H:i:s", strtotime($mail_header->date));
     $mail_details = array();
     if (Toolbox::strtolower($sender->mailbox) != 'mailer-daemon' && Toolbox::strtolower($sender->mailbox) != 'postmaster') {
         // Construct to and cc arrays
         $tos = array();
         $ccs = array();
         if (count($mail_header->to)) {
             foreach ($mail_header->to as $data) {
                 $mailto = Toolbox::strtolower($data->mailbox) . '@' . $data->host;
                 if ($mailto === $this->fields['name']) {
                     $to = $data;
                 }
                 $tos[] = $mailto;
             }
         }
         if (isset($mail_header->cc) && count($mail_header->cc)) {
             foreach ($mail_header->cc as $data) {
                 $ccs[] = Toolbox::strtolower($data->mailbox) . '@' . $data->host;
             }
         }
         // secu on subject setting
         if (!isset($mail_header->subject)) {
             $mail_header->subject = '';
         }
         $mail_details = array('from' => Toolbox::strtolower($sender->mailbox) . '@' . $sender->host, 'subject' => $mail_header->subject, 'to' => Toolbox::strtolower($to->mailbox) . '@' . $to->host, 'message_id' => $mail_header->message_id, 'tos' => $tos, 'ccs' => $ccs, 'date' => $date);
         if (isset($mail_header->references)) {
             $mail_details['references'] = $mail_header->references;
         }
         if (isset($mail_header->in_reply_to)) {
             $mail_details['in_reply_to'] = $mail_header->in_reply_to;
         }
         //Add additional headers in X-
         foreach ($this->getAdditionnalHeaders($mid) as $header => $value) {
             $mail_details[$header] = $value;
         }
     }
     return $mail_details;
 }
开发者ID:remicollet,项目名称:glpi,代码行数:57,代码来源:mailcollector.class.php

示例6: prepareInputForUpdate

 function prepareInputForUpdate($input)
 {
     if (isset($input["rootdn_passwd"])) {
         if (empty($input["rootdn_passwd"])) {
             unset($input["rootdn_passwd"]);
         } else {
             $input["rootdn_passwd"] = Toolbox::encrypt(stripslashes($input["rootdn_passwd"]), GLPIKEY);
         }
     }
     if (isset($input["_blank_passwd"]) && $input["_blank_passwd"]) {
         $input['rootdn_passwd'] = '';
     }
     // Set attributes in lower case
     if (count($input)) {
         foreach ($input as $key => $val) {
             if (preg_match('/_field$/', $key)) {
                 $input[$key] = Toolbox::strtolower($val);
             }
         }
     }
     return $input;
 }
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:22,代码来源:authldap.class.php

示例7: match

 /**
  * Try to match a definied rule
  *
  * @param &$criterion         RuleCriteria object
  * @param $field              the field to match
  * @param &$criterias_results
  * @param &$regex_result
  *
  * @return true if the field match the rule, false if it doesn't match
  **/
 static function match(RuleCriteria &$criterion, $field, &$criterias_results, &$regex_result)
 {
     $condition = $criterion->fields['condition'];
     $pattern = $criterion->fields['pattern'];
     $criteria = $criterion->fields['criteria'];
     //If pattern is wildcard, don't check the rule and return true
     //or if the condition is "already present in GLPI" : will be processed later
     if ($pattern == Rule::RULE_WILDCARD || $condition == Rule::PATTERN_FIND) {
         return true;
     }
     $pattern = trim($pattern);
     switch ($condition) {
         case Rule::PATTERN_EXISTS:
             return !empty($field);
         case Rule::PATTERN_DOES_NOT_EXISTS:
             return empty($field);
         case Rule::PATTERN_IS:
             if (is_array($field)) {
                 // Special case (used only by UNIQUE_PROFILE, for now)
                 // $pattern is an ID
                 if (in_array($pattern, $field)) {
                     $criterias_results[$criteria] = $pattern;
                     return true;
                 }
             } else {
                 //Perform comparison with fields in lower case
                 $field = Toolbox::strtolower($field);
                 $pattern = Toolbox::strtolower($pattern);
                 if ($field == $pattern) {
                     $criterias_results[$criteria] = $pattern;
                     return true;
                 }
             }
             return false;
         case Rule::PATTERN_IS_NOT:
             //Perform comparison with fields in lower case
             $field = Toolbox::strtolower($field);
             $pattern = Toolbox::strtolower($pattern);
             if ($field != $pattern) {
                 $criterias_results[$criteria] = $pattern;
                 return true;
             }
             return false;
         case Rule::PATTERN_UNDER:
             $table = getTableNameForForeignKeyField($criteria);
             $values = getSonsOf($table, $pattern);
             if (isset($values[$field])) {
                 return true;
             }
             return false;
         case Rule::PATTERN_NOT_UNDER:
             $table = getTableNameForForeignKeyField($criteria);
             $values = getSonsOf($table, $pattern);
             if (isset($values[$field])) {
                 return false;
             }
             return true;
         case Rule::PATTERN_END:
             $value = "/" . $pattern . "\$/i";
             if (preg_match($value, $field) > 0) {
                 $criterias_results[$criteria] = $pattern;
                 return true;
             }
             return false;
         case Rule::PATTERN_BEGIN:
             if (empty($pattern)) {
                 return false;
             }
             $value = mb_stripos($field, $pattern, 0, 'UTF-8');
             if ($value !== false && $value == 0) {
                 $criterias_results[$criteria] = $pattern;
                 return true;
             }
             return false;
         case Rule::PATTERN_CONTAIN:
             if (empty($pattern)) {
                 return false;
             }
             $value = mb_stripos($field, $pattern, 0, 'UTF-8');
             if ($value !== false && $value >= 0) {
                 $criterias_results[$criteria] = $pattern;
                 return true;
             }
             return false;
         case Rule::PATTERN_NOT_CONTAIN:
             if (empty($pattern)) {
                 return false;
             }
             $value = mb_stripos($field, $pattern, 0, 'UTF-8');
             if ($value === false) {
//.........这里部分代码省略.........
开发者ID:korial29,项目名称:glpi,代码行数:101,代码来源:rulecriteria.class.php

示例8: showDispoAndFormResa

 /**
  * Fonction permettant d'afficher les materiels disponibles et de faire une nouvelle reservation
  * C'est juste une interface differente de celle de GLPI. Pour les nouvelles reservations, on utilise les fonctions du coeur de GLPI
  **/
 function showDispoAndFormResa()
 {
     global $DB, $CFG_GLPI, $datesresa;
     $showentity = Session::isMultiEntitiesMode();
     $begin = $datesresa["begin"];
     $end = $datesresa["end"];
     $left = "";
     $where = "";
     echo "<div class='center'>";
     echo "<form name='form' method='GET' action='../../../front/reservation.form.php'>";
     echo "<table class='tab_cadre' style=\"border-spacing:20px;\">";
     echo "<tr>";
     foreach ($CFG_GLPI["reservation_types"] as $itemtype) {
         if (!($item = getItemForItemtype($itemtype))) {
             continue;
         }
         $itemtable = getTableForItemType($itemtype);
         $otherserial = "'' AS otherserial";
         if ($item->isField('otherserial')) {
             $otherserial = "`{$itemtable}`.`otherserial`";
         }
         if (isset($begin) && isset($end)) {
             $left = "LEFT JOIN `glpi_reservations`\n\t  ON (`glpi_reservationitems`.`id` = `glpi_reservations`.`reservationitems_id`\n\t      AND '" . $begin . "' < `glpi_reservations`.`end`\n\t      AND '" . $end . "' > `glpi_reservations`.`begin`)";
             $where = " AND `glpi_reservations`.`id` IS NULL ";
         }
         $query = "SELECT `glpi_reservationitems`.`id`,\n\t`glpi_reservationitems`.`comment`,\n\t`{$itemtable}`.`id` AS materielid,\n\t`{$itemtable}`.`name` AS name,\n\t`{$itemtable}`.`entities_id` AS entities_id,\n\t{$otherserial},\n\t`glpi_locations`.`completename` AS location,\n\t`glpi_reservationitems`.`items_id` AS items_id\n\t  FROM `glpi_reservationitems`\n\t  {$left}\n\t  INNER JOIN `{$itemtable}`\n\t  ON (`glpi_reservationitems`.`itemtype` = '{$itemtype}'\n\t      AND `glpi_reservationitems`.`items_id` = `{$itemtable}`.`id`)\n\t  LEFT JOIN `glpi_locations`\n\t  ON (`{$itemtable}`.`locations_id` = `glpi_locations`.`id`)\n\t  WHERE `glpi_reservationitems`.`is_active` = '1'\n\t  AND `glpi_reservationitems`.`is_deleted` = '0'\n\t  AND `{$itemtable}`.`is_deleted` = '0'\n\t  {$where} " . getEntitiesRestrictRequest(" AND", $itemtable, '', $_SESSION['glpiactiveentities'], $item->maybeRecursive()) . "\n\t  ORDER BY `{$itemtable}`.`entities_id`,\n\t`{$itemtable}`.`name`";
         if ($result = $DB->query($query)) {
             if ($DB->numrows($result)) {
                 echo "<td>";
                 echo "<table class='tab_cadre'>";
                 echo "<tr><th colspan='" . ($showentity ? "6" : "5") . "'>" . $item->getTypeName() . "</th></tr>\n";
             }
             while ($row = $DB->fetch_assoc($result)) {
                 echo "<tr class='tab_bg_2'><td>";
                 echo "<input type='checkbox' name='item[" . $row["id"] . "]' value='" . $row["id"] . "'>" . "</td>";
                 $typename = $item->getTypeName();
                 if ($itemtype == 'Peripheral') {
                     $item->getFromDB($row['items_id']);
                     if (isset($item->fields["peripheraltypes_id"]) && $item->fields["peripheraltypes_id"] != 0) {
                         $typename = Dropdown::getDropdownName("glpi_peripheraltypes", $item->fields["peripheraltypes_id"]);
                     }
                 }
                 echo "<td white-space: nowrap ><a href='" . getGLPIUrl() . "front/" . Toolbox::strtolower($itemtype) . ".form.php?id=" . $row['materielid'] . "&forcetab=Reservation\$1" . "'>" . sprintf(__('%1$s'), $row["name"]) . "</a></td>";
                 echo "<td>" . nl2br($row["comment"]) . "</td>";
                 if ($showentity) {
                     echo "<td>" . Dropdown::getDropdownName("glpi_entities", $row["entities_id"]) . "</td>";
                 }
                 echo "<td><a title=\"Voir le planning\" href='../../../front/reservation.php?reservationitems_id=" . $row['id'] . "'>" . "<img title=\"\" alt=\"\" src=\"" . getGLPIUrl() . "pics/reservation-3.png\"></img></a></td>";
                 echo "</tr>\n";
             }
         }
         if ($DB->numrows($result)) {
             echo "</td>";
             echo "</table>\n";
         }
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1 center'><td colspan='" . ($showentity ? "5" : "4") . "'>";
     echo "<input type='submit' value=\"Réserver\" class='submit'></td></tr>\n";
     echo "</table>\n";
     echo "<input type='hidden' name='id' value=''>";
     Html::closeForm();
     echo "</div>\n";
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:68,代码来源:reservation.class.php

示例9: addToAddressesList

 /**
  * Add new mail with lang to current email array
  *
  * @param $data   array of data (mail, lang[, id for user])
  **/
 function addToAddressesList(array $data)
 {
     global $CFG_GLPI;
     // No email set : get default for user
     if (!isset($data['email']) && isset($data['users_id'])) {
         $data['email'] = UserEmail::getDefaultForUser($data['users_id']);
     }
     $new_mail = trim(Toolbox::strtolower($data['email']));
     $new_lang = '';
     // Default USER TYPE is ANONYMOUS
     $notificationoption = array('usertype' => self::ANONYMOUS_USER);
     if (isset($data['language'])) {
         $new_lang = trim($data['language']);
     }
     $username = '';
     if (isset($data['name']) && !empty($data['name'])) {
         $username = $data['name'];
     }
     if (isset($data['users_id']) && $data['users_id'] > 0) {
         $user = new User();
         if (!$user->getFromDB($data['users_id']) || $user->getField('is_deleted') == 1 || $user->getField('is_active') == 0 || !is_null($user->getField('begin_date')) && $user->getField('begin_date') > $_SESSION["glpi_currenttime"] || !is_null($user->getField('end_date')) && $user->getField('end_date') < $_SESSION["glpi_currenttime"]) {
             // unknown, deleted or disabled user
             return false;
         }
         $filt = getEntitiesRestrictRequest('AND', 'glpi_profiles_users', '', $this->getEntity(), true);
         $prof = Profile_User::getUserProfiles($data['users_id'], $filt);
         if (!count($prof)) {
             // No right on the entity of the object
             return false;
         }
         if (empty($username)) {
             $username = formatUserName(0, $user->getField('name'), $user->getField('realname'), $user->getField('firstname'), 0, 0, true);
         }
         // It is a GLPI user :
         $notificationoption['usertype'] = self::GLPI_USER;
         if (Auth::isAlternateAuth($user->fields['authtype']) || $user->fields['authtype'] == Auth::NOT_YET_AUTHENTIFIED && Auth::isAlternateAuth(Auth::checkAlternateAuthSystems())) {
             $notificationoption['usertype'] = self::EXTERNAL_USER;
         }
     }
     // Pass user type as argument ? forced for specific cases
     if (isset($data['usertype'])) {
         $notificationoption['usertype'] = $data['usertype'];
     }
     $notificationoption = array_merge($this->addAdditionnalUserInfo($data), $notificationoption);
     if (!empty($new_mail)) {
         if (NotificationMail::isUserAddressValid($new_mail) && !isset($this->target[$new_mail])) {
             $param = array('language' => empty($new_lang) ? $CFG_GLPI["language"] : $new_lang, 'email' => $new_mail, 'additionnaloption' => $notificationoption, 'username' => $username);
             if (isset($data['users_id']) && $data['users_id']) {
                 $param['users_id'] = $data['users_id'];
             }
             $this->target[$new_mail] = $param;
         }
     }
 }
开发者ID:kipman,项目名称:glpi,代码行数:59,代码来源:notificationtarget.class.php

示例10: getFieldsToLookFor

 /**
  * Get all the fields needed to perform the rule
  **/
 function getFieldsToLookFor()
 {
     global $DB;
     $params = array();
     $query = "SELECT DISTINCT `glpi_rulecriterias`.`criteria` AS `criteria`\n                FROM `glpi_rules`,\n                     `glpi_rulecriterias`\n                WHERE `glpi_rules`.`sub_type` = '" . $this->getRuleClassName() . "'\n                      AND `glpi_rulecriterias`.`rules_id` = `glpi_rules`.`id`\n                      AND `glpi_rules`.`is_active` = '1'";
     foreach ($DB->request($query) as $param) {
         $params[] = Toolbox::strtolower($param["criteria"]);
     }
     return $params;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:13,代码来源:rulecollection.class.php

示例11: giveItem


//.........这里部分代码省略.........
                             }
                             $count_display++;
                             $out .= $text;
                             $added[] = $text;
                         }
                     }
                 }
                 return $out;
             }
             break;
         case "glpi_documenttypes.icon":
             if (!empty($data[$NAME . $num])) {
                 return "<img class='middle' alt='' src='" . $CFG_GLPI["typedoc_icon_dir"] . "/" . $data[$NAME . $num] . "'>";
             }
             return "&nbsp;";
         case "glpi_documents.filename":
             $doc = new Document();
             if ($doc->getFromDB($data['id'])) {
                 return $doc->getDownloadLink();
             }
             return NOT_AVAILABLE;
         case "glpi_deviceharddrives.specificity":
         case "glpi_devicememories.specificity":
         case "glpi_deviceprocessors.specificity":
             return $data[$NAME . $num];
         case "glpi_networkports.mac":
             $out = "";
             if ($itemtype == 'Computer') {
                 $displayed = array();
                 if (!empty($data[$NAME . $num . "_2"])) {
                     $split = explode("\$\$\$\$", $data[$NAME . $num . "_2"]);
                     $count_display = 0;
                     for ($k = 0; $k < count($split); $k++) {
                         $lowstr = Toolbox::strtolower($split[$k]);
                         if (strlen(trim($split[$k])) > 0 && !in_array($lowstr, $displayed)) {
                             if ($count_display) {
                                 $out .= "<br>";
                             }
                             $count_display++;
                             $out .= $split[$k];
                             $displayed[] = $lowstr;
                         }
                     }
                     if (!empty($data[$NAME . $num])) {
                         $out .= "<br>";
                     }
                 }
                 if (!empty($data[$NAME . $num])) {
                     $split = explode("\$\$\$\$", $data[$NAME . $num]);
                     $count_display = 0;
                     for ($k = 0; $k < count($split); $k++) {
                         $lowstr = Toolbox::strtolower($split[$k]);
                         if (strlen(trim($split[$k])) > 0 && !in_array($lowstr, $displayed)) {
                             if ($count_display) {
                                 $out .= "<br>";
                             }
                             $count_display++;
                             $out .= $split[$k];
                             $displayed[] = $lowstr;
                         }
                     }
                 }
                 return $out;
             }
             break;
         case "glpi_contracts.duration":
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:67,代码来源:searcha.class.php

示例12: getDatasForTemplate

 /**
  * Get all data needed for template processing
  *
  * @param $event
  * @param $options array
  **/
 function getDatasForTemplate($event, $options = array())
 {
     global $CFG_GLPI;
     $events = $this->getAllEvents();
     $objettype = strtolower($this->obj->getType());
     // Get datas from ITIL objects
     if ($event != 'alertnotclosed') {
         $this->datas = $this->getDatasForObject($this->obj, $options);
     } else {
         if (isset($options['entities_id']) && isset($options['items'])) {
             $entity = new Entity();
             if ($entity->getFromDB($options['entities_id'])) {
                 $this->datas["##{$objettype}.entity##"] = $entity->getField('completename');
                 $this->datas["##{$objettype}.shortentity##"] = $entity->getField('name');
             }
             if ($item = getItemForItemtype($objettype)) {
                 $objettypes = Toolbox::strtolower(getPlural($objettype));
                 $items = array();
                 foreach ($options['items'] as $object) {
                     $item->getFromDB($object['id']);
                     $tmp = $this->getDatasForObject($item, $options, true);
                     $this->datas[$objettypes][] = $tmp;
                 }
             }
         }
     }
     if ($event == 'validation' && isset($options['validation_status'])) {
         $this->datas["##{$objettype}.action##"] = sprintf(__('%1$s - %2$s'), __('Approval'), TicketValidation::getStatus($options['validation_status']));
     } else {
         $this->datas["##{$objettype}.action##"] = $events[$event];
     }
     $this->getTags();
     foreach ($this->tag_descriptions[parent::TAG_LANGUAGE] as $tag => $values) {
         if (!isset($this->datas[$tag])) {
             $this->datas[$tag] = $values['label'];
         }
     }
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:44,代码来源:notificationtargetcommonitilobject.class.php

示例13: _putfonts


//.........这里部分代码省略.........
         $f = fopen($this->_getfontpath() . $file, 'rb', 1);
         if (!$f) {
             $this->Error('Font file not found');
         }
         while (!feof($f)) {
             $font .= fread($f, 8192);
         }
         fclose($f);
         $compressed = substr($file, -2) == '.z';
         if (!$compressed && isset($info['length2'])) {
             $header = ord($font[0]) == 128;
             if ($header) {
                 //Strip first binary header
                 $font = substr($font, 6);
             }
             if ($header && ord($font[$info['length1']]) == 128) {
                 //Strip second binary header
                 $font = substr($font, 0, $info['length1']) . substr($font, $info['length1'] + 6);
             }
         }
         $this->_out('<</Length ' . strlen($font));
         if ($compressed) {
             $this->_out('/Filter /FlateDecode');
         }
         $this->_out('/Length1 ' . $info['length1']);
         if (isset($info['length2'])) {
             $this->_out('/Length2 ' . $info['length2'] . ' /Length3 0');
         }
         $this->_out('>>');
         $this->_putstream($font);
         $this->_out('endobj');
     }
     ini_set("magic_quotes_runtime", $mqr);
     foreach ($this->fonts as $k => $font) {
         //Font objects
         $this->fonts[$k]['n'] = $this->n + 1;
         $type = $font['type'];
         $name = $font['name'];
         if ($type == 'core') {
             //Standard font
             $this->_newobj();
             $this->_out('<</Type /Font');
             $this->_out('/BaseFont /' . $name);
             $this->_out('/Subtype /Type1');
             if ($name != 'Symbol' && $name != 'ZapfDingbats') {
                 $this->_out('/Encoding /WinAnsiEncoding');
             }
             $this->_out('>>');
             $this->_out('endobj');
         } else {
             if ($type == 'Type1' || $type == 'TrueType') {
                 //Additional Type1 or TrueType font
                 $this->_newobj();
                 $this->_out('<</Type /Font');
                 $this->_out('/BaseFont /' . $name);
                 $this->_out('/Subtype /' . $type);
                 $this->_out('/FirstChar 32 /LastChar 255');
                 $this->_out('/Widths ' . ($this->n + 1) . ' 0 R');
                 $this->_out('/FontDescriptor ' . ($this->n + 2) . ' 0 R');
                 if ($font['enc']) {
                     if (isset($font['diff'])) {
                         $this->_out('/Encoding ' . ($nf + $font['diff']) . ' 0 R');
                     } else {
                         $this->_out('/Encoding /WinAnsiEncoding');
                     }
                 }
                 $this->_out('>>');
                 $this->_out('endobj');
                 //Widths
                 $this->_newobj();
                 $cw =& $font['cw'];
                 $s = '[';
                 for ($i = 32; $i <= 255; $i++) {
                     $s .= $cw[chr($i)] . ' ';
                 }
                 $this->_out($s . ']');
                 $this->_out('endobj');
                 //Descriptor
                 $this->_newobj();
                 $s = '<</Type /FontDescriptor /FontName /' . $name;
                 foreach ($font['desc'] as $k => $v) {
                     $s .= ' /' . $k . ' ' . $v;
                 }
                 $file = $font['file'];
                 if ($file) {
                     $s .= ' /FontFile' . ($type == 'Type1' ? '' : '2') . ' ' . $this->FontFiles[$file]['n'] . ' 0 R';
                 }
                 $this->_out($s . '>>');
                 $this->_out('endobj');
             } else {
                 //Allow for additional types
                 $mtd = '_put' . Toolbox::strtolower($type);
                 if (!method_exists($this, $mtd)) {
                     $this->Error('Unsupported font type: ' . $type);
                 }
                 $this->{$mtd}($font);
             }
         }
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:fpdf.php

示例14: mainLine

 static function mainLine(PluginPdfSimplePDF $pdf, $item, $field)
 {
     $type = Toolbox::strtolower($item->getType());
     switch ($field) {
         case 'name-status':
             return $pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Name') . '</i></b>', $item->fields['name']), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Status') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_states', $item->fields['states_id']))));
         case 'location-type':
             return $pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Location') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_locations', $item->fields['locations_id']))), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Type') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_' . $type . 'types', $item->fields[$type . 'types_id']))));
         case 'tech-manufacturer':
             return $pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Technician in charge of the hardware') . '</i></b>', getUserName($item->fields['users_id_tech'])), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Manufacturer') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_manufacturers', $item->fields['manufacturers_id']))));
         case 'group-model':
             return $pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Group in charge of the hardware') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_groups', $item->fields['groups_id_tech']))), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Model') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_' . $type . 'models', $item->fields[$type . 'models_id']))));
         case 'contactnum-serial':
             return $pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Alternate username number') . '</i></b>', $item->fields['contact_num']), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Serial number') . '</i></b>', $item->fields['serial']));
         case 'contact-otherserial':
             return $pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Alternate username') . '</i></b>', $item->fields['contact']), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Inventory number') . '</i></b>', $item->fields['otherserial']));
         case 'user-management':
             return $pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('User') . '</i></b>', getUserName($item->fields['users_id'])), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Management type') . '</i></b>', $item->fields['is_global'] ? __('Global management') : __('Unit management')));
         case 'comment':
             return $pdf->displayText('<b><i>' . sprintf(__('%1$s: %2$s'), __('Comments') . '</i></b>', $item->fields['comment']));
         default:
             return;
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:24,代码来源:common.class.php


注:本文中的Toolbox::strtolower方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。