コード例 #1
0
ファイル: SAPObj.php プロジェクト: nipisarev/SAPExporter
 /**
  * @param SAPUser $user
  * @param $hr
  * @param $manager
  * @param $matrixManager
  * @param $date_reg
  */
 public function __construct(SAPUser $user, $hr, $manager, $matrixManager, $date_reg)
 {
     $this->data['hr'] = $hr;
     $this->data['manager'] = $manager;
     $this->data['matrixManager'] = $matrixManager;
     $this->data['date_reg'] = $date_reg;
     $attr = ['externalId' => $user->get('id'), 'status' => 'ACTIVE', 'username' => $user->get('email'), 'dateOfBirth' => $user->get('DOB'), 'firstName' => $user->get('firstName'), 'lastName' => $user->get('lastName'), 'mi' => $user->get('middleName'), 'email' => $user->get('email'), 'managerExternalId' => $this->data['manager'], 'hrExternalId' => $this->data['hr'], 'newToPosition' => 'false', 'hireDate' => $this->data['date_reg'], 'country' => '3174', 'state' => 'N/A', 'city' => 'N/A', 'defaultLocale' => 'ru_RU', 'companyExitDate' => '2038-12-31', 'custom03' => $user->get('subject'), 'custom04' => 'N/A', 'custom05' => 'N/A', 'custom06' => 'N/A', 'custom07' => 'N/A', 'custom08' => 'N/A', 'custom09' => '3261', 'matrixManagerExternalIds' => $this->data['matrixManager']];
     foreach ($attr as $key => $value) {
         $xml = new xmlWriter();
         $xml->openMemory();
         $xml->startElement($key);
         $xml->text($value);
         $xml->endElement();
         $this->body .= $xml->outputMemory(true);
     }
 }
コード例 #2
0
ファイル: tags.php プロジェクト: raalveco/Escuela
/**
 * Construye un tag xhtml
 *
 * @param string $tag nombre de etiqueta
 * @param array $attrs atributos para la etiqueta
 *
 * content: contenido, este parametro con nombre es incluido debido a que
 *  el argumento $content puede ser confundido con un parametro con nombre,
 *  si este llegase a poseer la sintaxis de los parametros con nombre.
 *
 * Nota: el parametro con nombre content nunca es utilizado como un atributo
 *  para el tag, a menos de que este se pase en el array de atributos.
 *
 * @return string
 **/
function xhtml_tag($tag, $attrs = null)
{
    $params = is_array($tag) ? $tag : Util::getParams(func_get_args());
    $xw = new xmlWriter();
    $xw->openMemory();
    if (APP_CHARSET != 'UTF-8' && APP_CHARSET != 'ISO-8859-1') {
        $params = utf8_encode($params);
    }
    /**
     * Pueden tener cierre corto
     **/
    $short_close = array('input', 'link', 'img');
    /**
     * Necesitan estar entre CDATA
     **/
    $need_cdata = array('script', 'style', 'a');
    $tag = $params[0];
    unset($params[0]);
    /**
     * Cargo el contenido interno para el tag
     */
    if (isset($params['content'])) {
        $content = $params['content'];
        unset($params['content']);
    } else {
        $content = '';
    }
    if (isset($params[1]) && is_array($params[1])) {
        $attrs = $params[1];
        unset($params[1]);
        $attrs = array_merge($attrs, $params);
    } else {
        $attrs = $params;
    }
    $xw->startElement($tag);
    foreach ($attrs as $k => $v) {
        if (!is_numeric($k)) {
            @$xw->writeAttribute($k, $v);
        }
    }
    if ($content || !in_array($tag, $short_close)) {
        if ($tag == 'select' || in_array($tag, $need_cdata)) {
            $xw->writeRaw($content);
        } else {
            $xw->text($content);
        }
    }
    $xw->endElement();
    return $xw->outputMemory(true);
}
コード例 #3
0
ファイル: models.php プロジェクト: rsinger/Jangle
 function daia($data, $resource)
 {
     $xml = new xmlWriter();
     $xml->openMemory();
     $xml->startElement("daia");
     $xml->writeAttribute("xmlns", "http://ws.gbv.de/daia/");
     $xml->writeElement("timestamp", strftime("%Y-%m-%dT%H:%m:%s-%Z"));
     $xml->startElement("item");
     $xml->writeElement("id", $resource->id);
     $xml->writeElement("localid", $data["barcode_nmbr"]);
     $availability = array("service" => "loan", "available" => "false");
     if (preg_match("/in|dis/", $data["status_cd"])) {
         $availability["available"] = "true";
     }
     if ($data["status_cd"] == "out") {
         $now = time();
         $then = strtotime($data["due_back_dt"]);
         $delay = round(($now - $then) / 86400);
         $availability["delay"] = "P" . $delay . "D";
     } elseif ($data["status_cd"] == "out") {
         $availability["delay"] = "inf";
     } elseif ($data["status_cd"] == "disp") {
         $availability["service"] = "presentation";
     }
     $q = "SELECT material_cd FROM biblio WHERE bibid = " . $data["bibid"];
     $r = mysql_query($q);
     $row = mysql_fetch_row($r);
     if ($row[0] == 6) {
         $availability["service"] = "presentation";
     }
     $xml->startElement("availability");
     for ($i = 0; $i < count($availability); $i++) {
         $xml->writeAttribute(key($availability), $availability[key($availability)]);
         next($availability);
     }
     $xml->startElement("message");
     $xml->writeAttribute("lang", "en");
     $xml->text($data["description"]);
     $xml->endElement();
     $xml->endElement();
     $xml->endElement();
     $xml->endElement();
     return $xml->outputMemory(true);
 }
コード例 #4
0
ファイル: JangleClasses.php プロジェクト: rsinger/Jangle
 function toXML()
 {
     $xml = new xmlWriter();
     $xml->openMemory();
     $xml->startDocument('1.0', 'UTF-8');
     $xml->startElement("OpenSearchDescription");
     $xml->writeAttribute("xmlns", "http://a9.com/-/spec/opensearch/1.1/");
     $xml->writeAttribute("xmlns:jangle", "http://jangle.org/opensearch/");
     $xml->writeElement("ShortName", $this->shortName);
     if (isset($this->longName)) {
         $xml->writeElement("LongName", $this->longName);
     }
     if (isset($this->description)) {
         $xml->writeElement("Description", $this->description);
     }
     if (isset($this->developer)) {
         $xml->writeElement("Developer", $this->description);
     }
     if (isset($this->contact)) {
         $xml->writeElement("Contact", $this->contact);
     }
     if (isset($this->attribution)) {
         $xml->writeELement("Attribution", $this->attribution);
     }
     if (isset($this->syndicationRight)) {
         $xml->writeElement("SyndicationRight", $this->syndicationRight);
     }
     if (isset($this->adultContent)) {
         $xml->writeElement("adultContent", $this->adultContent);
     }
     if (isset($this->language)) {
         if (is_array($this->language)) {
             for ($i = 0; $i < count($this->language); $i++) {
                 $xml->writeELement("Language", $this->language[$i]);
             }
         } else {
             $xml->writeElement("Language", $this->language);
         }
     }
     if (count($this->inputEncoding)) {
         if (is_array($this->inputEncoding)) {
             for ($i = 0; $i < count($this->inputEncoding); $i++) {
                 $xml->writeELement("InputEncoding", $this->inputEncoding[$i]);
             }
         } else {
             $xml->writeElement("InputEncoding", $this->inputEncoding);
         }
     }
     if (count($this->outputEncoding)) {
         if (is_array($this->outputEncoding)) {
             for ($i = 0; $i < count($this->outputEncoding); $i++) {
                 $xml->writeELement("OutputEncoding", $this->OuputEncoding[$i]);
             }
         } else {
             $xml->writeElement("OuputEncoding", $this->OuputEncoding);
         }
     }
     if (count($this->tags)) {
         $xml->writeElement("Tags", join($this->tags, " "));
     }
     if (count($this->image)) {
         $xml->startElement("Image", $this->image["location"]);
         if ($this->image["height"]) {
             $xml->writeAttribute("height", $this->image["height"]);
         }
         if ($this->image["width"]) {
             $xml->writeAttribute("width", $this->image["width"]);
         }
         if ($this->image["type"]) {
             $xml->writeAttribute("type", $this->image["type"]);
         }
         $xml->endElement();
     }
     if (count($this->indexes) || isset($this->exampleQuery)) {
         $xml->startElement("Query");
         if (isset($this->exampleQuery)) {
             $xml->writeAttribute("role", "example");
             $xml->writeAttribute("searchTerms", $this->exampleQuery);
         }
         if (count($this->indexes)) {
             $xml->startElement("zr:explain");
             $xml->writeAttribute("xmlns:zr", "http://explain.z3950.org/dtd/2.1/");
             $xml->startElement("zr:indexInfo");
             for ($i = 0; $i < count($this->indexes); $i++) {
                 $xml->startElement("zr:set");
                 $xml->writeAttribute("name", $this->indexes[$i]->name);
                 if ($this->indexes[$i]->identifier) {
                     $xml->writeAttribute("identifier", $this->indexes[$i]->identifier);
                 }
                 $xml->endELement();
                 for ($x = 0; $x < count($this->indexes[$i]->indexes); $x++) {
                     $xml->startElement("zr:index");
                     $xml->startElement("zr:map");
                     $xml->startElement("zr:name");
                     $xml->writeAttribute("set", $this->indexes[$i]->name);
                     $xml->text($this->indexes[$i]->indexes[$x]);
                     $xml->endElement();
                     $xml->endElement();
                     $xml->endELement();
                 }
             }
             $xml->endElement();
             $xml->endElement();
         }
         $xml->endElement();
     }
     $xml->endElement();
     return $xml->outputMemory(true);
 }