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


PHP I2CE::getFileSearch方法代码示例

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


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

示例1: updateLocales

 public function updateLocales($args)
 {
     $fileSearch = I2CE::getFileSearch();
     if ($fileSearch instanceof I2CE_FileSearch_Caching) {
         $fileSearch->clearCache();
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:7,代码来源:I2CE_Module_Core.php

示例2: loadMimeTypes

 /**
  * Loads in the file containing mime types and extensions
  */
 protected static function loadMimeTypes()
 {
     self::$extToMimeTypes = array();
     $mime_file = null;
     if (I2CE::getConfig()->setIfIsSet($mime_file, "/modules/MimeTypes/mime_types")) {
         $mime_file = I2CE::getFileSearch()->search('MIME', $mime_file);
     }
     if (empty($mime_file)) {
         I2CE::raiseError('Unable to find mime.types file.', E_USER_WARNING);
         return;
     }
     $a = file($mime_file);
     if (empty($a)) {
         I2CE::raiseError('mime.types file is empty.', E_USER_WARNING);
         return;
     }
     foreach ($a as $l) {
         $l = trim($l);
         if (strlen($l) < 1 || $l[0] == '#') {
             //skip comments
             continue;
         }
         $pieces = preg_split("/\\s+/", $l, -1, PREG_SPLIT_NO_EMPTY);
         if (empty($pieces)) {
             //a blank line
             continue;
         }
         $mime = strtolower(array_shift($pieces));
         foreach ($pieces as $ext) {
             self::$extToMimeTypes[strtolower($ext)] = $mime;
         }
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:36,代码来源:I2CE_MimeTypes.php

示例3: getAvailableModules

function getAvailableModules()
{
    global $configurator;
    global $modules;
    global $search_dirs;
    global $found_modules;
    global $booleans;
    if (is_array($found_modules)) {
        return $found_modules;
    }
    $found_modules = array();
    $bad_modules = array();
    foreach ($search_dirs as $dir) {
        foreach (glob($dir) as $d) {
            $d = realpath($d);
            I2CE::raiseError("Searching {$d}");
            I2CE::setupFileSearch(array('MODULES' => $d));
            $fileSearch = I2CE::getFileSearch();
            $top_module = $configurator->findAvailableConfigs($fileSearch, false);
            if (!is_array($top_module) || count($top_module) != 1) {
                I2CE::raiseError("WARNING:  no top-level module found for {$dir} -- Skipping.");
                continue;
            }
            $top_module = $top_module[0];
            I2CE::raiseError("Found {$top_module} as top-level module for {$d}");
            $searchPath = $fileSearch->getSearchPath('MODULES', true);
            if ($booleans['limit_search']) {
                I2CE::raiseError("Limiting search to {$d}");
                $avail_modules = $configurator->findAvailableConfigs($fileSearch, true, $d);
            } else {
                $avail_modules = $configurator->findAvailableConfigs($fileSearch, true);
            }
            if (is_array($modules)) {
                $avail_modules = array_intersect($modules, $avail_modules);
            }
            foreach ($avail_modules as $m) {
                if (array_key_exists($m, $found_modules)) {
                    I2CE::raiseError("WARNING: conflict with module {$m}.  Found more than once -- Skipping");
                    $found_modules[$m] = false;
                    $bad_modules[] = $m;
                } else {
                    $found_modules[$m] = $top_module;
                }
            }
        }
    }
    foreach ($bad_modules as $m) {
        unset($found_modules[$m]);
    }
    if (count($found_modules) == 0) {
        usage("No modules files found in this directory:\n\t" . implode("\n\t", $search_dirs) . "\n");
    }
    return $found_modules;
}
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:54,代码来源:base.php

示例4: getViewTemplate

 /**
  * Return the HTML file name for the view template for this form.
  * @return string
  */
 public function getViewTemplate($type = 'default')
 {
     if (!$type || $type == 'default') {
         if ($template_file = I2CE::getFileSearch()->search('TEMPLATES', "view_list_" . $this->getName() . ".html")) {
             return $template_file;
         } else {
             return "view_list_simple_coded.html";
         }
     } else {
         if ($template_file = I2CE::getFileSearch()->search('TEMPLATES', "view_list_" . $this->getName() . "_alternate_{$type}.html")) {
             return $template_file;
         } else {
             return "view_list_simple_coded_alternate_{$type}.html";
         }
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:20,代码来源:I2CE_SimpleCodedList.php

示例5: getXSLTS

 protected function getXSLTS()
 {
     $file_search = I2CE::getFileSearch();
     $file_search->loadPaths('XSLTS');
     $files = $file_search->findByGlob('XSLTS', array('*XSL', '*xsl'), true);
     $pathset = $file_search->getSearchPath('XSLTS');
     $options = array();
     foreach ($files as $file) {
         foreach ($pathset as $paths) {
             foreach ($paths as $path) {
                 if (strpos($file, $path) === 0) {
                     $options[] = substr($file, strlen($path) + 1);
                     continue 3;
                 }
             }
         }
     }
     return $options;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:19,代码来源:I2CE_Swiss_PageXMLRelationship_Args.php

示例6: setData

 /**
  * Set the data for the chart.
  * @return boolean
  */
 protected function setData()
 {
     if (count($this->request_remainder) > 0) {
         $csv = array_shift($this->request_remainder);
     } else {
         I2CE::raiseError("No CSV file given for pChart File.");
         return false;
     }
     $csv_file = I2CE::getFileSearch()->search("PCHART_DATA", $csv);
     if ($csv_file === null) {
         I2CE::raiseError("Unable to find CSV file ({$csv}) for pChart File.");
         return false;
     }
     $options = array();
     if ($this->get_exists('header')) {
         $options['GotHeader'] = true;
     }
     $this->chartData->importFromCSV($csv_file, $options);
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:24,代码来源:I2CE_PagePChartFile.php

示例7: processElement_image

 /**
  * Abstract business method to render a text element from the elements tree
  * @param int $left_x
  * @param int $top_y
  * @param array $formData of I2CE_Form
  * @param array $textProps
  * @param I2CE_MagicDataNode $elementConfig The node defining the element
  * @returns boolean. True on success
  */
 protected function processElement_image($left_x, $top_y, $formData, $textProps, $elementConfig)
 {
     $image = '';
     if (!$elementConfig->setIfIsSet($image, "image") || !$image) {
         I2CE::raiseError("No image set");
         return true;
         //error silently
     }
     $image_file = false;
     if (substr($image, 0, 7) == 'form://') {
         $image = substr($image, 7);
         if (strlen($image) == 0) {
             I2CE::raiseError("No image from form set");
             return true;
         }
         list($namedform, $field) = array_pad(explode('+', $image, 2), 2, '');
         if (!$namedform || !$field) {
             I2CE::raiseError("Image form {$image} is not in relationship");
             return true;
         }
         if (!array_key_exists($namedform, $formData)) {
             I2CE::raiseError("Form {$namedform} is not in relationship");
             return true;
         }
         if (!($fieldObj = $formData[$namedform]->getField($field)) instanceof I2CE_FormField_IMAGE) {
             I2CE::raiseError("Field {$field} of form {$namedform} is not an image");
             return true;
         }
         if (!$fieldObj->isValid()) {
             return true;
         }
         $image_content = $fieldObj->getBinaryData();
         if (strlen($image_content) == 0) {
             //no data
             return true;
         }
         $image_file = $image . '@' . $this->getCurrentId() . '.' . $fieldObj->getExtension();
         $this->pdf->addImageContent($image_content, $image_file);
     } else {
         $image_file = I2CE::getFileSearch()->search('PDF_IMAGES', $image);
         if (!$image_file) {
             $msg = "Header image ({$image}) not found" . "\nSearch Path is:\n" . print_r(I2CE::getFileSearch()->getSearchPath('PDF_IMAGES'), true);
             I2CE::raiseError($msg);
             return true;
             //error silently'
         }
     }
     $horiz_min = false;
     if (!$elementConfig->setIfIsSet($horiz_min, "horiz_min")) {
         I2CE::raiseError("horiz_min not set");
         return true;
         //error silently
     }
     $horiz_min = (int) $horiz_min;
     $horiz_min = max(0, $horiz_min);
     if ($horiz_min >= $this->layoutOptions['form_width']) {
         I2CE::raiseError("Element does not fit in form");
     }
     $vert_min = false;
     if (!$elementConfig->setIfIsSet($vert_min, "vert_min")) {
         I2CE::raiseError("vert_min not set");
         return true;
         //error silently
     }
     $horiz_max = false;
     $vert_min = max(0, $vert_min);
     if ($vert_min >= $this->layoutOptions['form_height']) {
         I2CE::raiseError("Element does not fit in form");
         return true;
         //error silently
     }
     $elementConfig->setIfIsSet($horiz_max, "horiz_max");
     $vert_max = false;
     $elementConfig->setIfIsSet($vert_max, "vert_max");
     if ($horiz_max == false) {
         $w = 0;
     } else {
         $w = min($horiz_max, $this->layoutOptions['form_width']) - $horiz_min;
     }
     if ($vert_max == false) {
         $h = 0;
     } else {
         $h = min($vert_max, $this->layoutOptions['form_height']) - $vert_min;
     }
     $k = $this->pdf->getScaleFactor();
     $this->pdf->SetXY($left_x + $horiz_min, $top_y + $vert_min);
     $this->pdf->Image($image_file, $left_x + $horiz_min, $top_y + $vert_min, $w, $h);
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:98,代码来源:I2CE_PrintedForm_Render_PDF.php

示例8: displayReportControls

 /**
  * Adds any report display controls that can be added for this view.
  * @param DOMNode $conentNode
  * @param mixed $controls  If null (default), we display all the report controls.  If string or an
  *                         array of string, we only display the indicated controls
  * @returns boolean 
  */
 protected function displayReportControls($contentNode, $controls = null)
 {
     $this->template->addHeaderLink('mootools-core.js');
     $this->template->addHeaderLink('I2CE_ClassValues.js');
     $this->template->addHeaderLink('I2CE_SubmitButton.js');
     $displays = array();
     $displayConfig = I2CE::getConfig()->modules->CustomReports->displays;
     if (!in_array('Default', $displays)) {
         $displays[] = 'Default';
     }
     if (is_string($controls)) {
         $controls = array($controls);
     }
     if (is_array($controls)) {
         $displays = array_intersect($displays, $controls);
     }
     if (count($displays) == 0) {
         $displays[] = 'Default';
     }
     if (in_array('Default', $displays) && count($displays) > 1) {
         foreach ($displays as $i => $display) {
             $hide = false;
             $displayConfig->setIfIsSet($hide, "{$display}/hide_with_default");
             if ($hide) {
                 unset($displays[$i]);
             }
         }
     }
     if (count($displays) > 1 && I2CE::getFileSearch()->search('TEMPLATES', "customReports_display_limit_apply_{$this->display}.html")) {
         $reportLimitsNode = $this->template->getElementById('report_limits');
         if ($reportLimitsNode instanceof DOMNode) {
             $applyNode = $this->template->appendFileByNode("customReports_display_limit_apply_{$this->display}.html", "tr", $reportLimitsNode);
         }
     }
     foreach ($displays as $display) {
         if ($display != $this->display) {
             if (!($displayObj = $this->page->instantiateDisplay($display, "UserStatistics")) instanceof I2CE_CustomReport_Display) {
                 continue;
             }
             if (!$displayObj->canView()) {
                 continue;
             }
         } else {
             $displayObj = $this;
         }
         $controlNode = $this->template->createElement('span', array('class' => 'CustomReport_control', 'id' => "CustomReport_controls_{$display}"));
         $contentNode->appendChild($controlNode);
         $displayObj->displayReportControl($controlNode);
     }
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:58,代码来源:iHRIS_CustomReport_Display_UserStatistics.php

示例9: dump

 protected function dump($vars)
 {
     $file_name = $vars['name'];
     if (empty($file_name)) {
         //do nothing if name is not set
         I2CE::raiseError("No file specified", E_USER_NOTICE);
         return;
     }
     //get the extension
     if (array_key_exists('ext', $vars)) {
         $ext = strtolower($vars['ext']);
     } else {
         $ext = strtolower(substr(strrchr($file_name, "."), 1));
     }
     $category = null;
     if (array_key_exists('cat', $vars)) {
         $category = $vars['cat'];
     }
     if (empty($category)) {
         //try to see if we have a default category
         if (array_key_exists($ext, $this->default_categories)) {
             $category = $this->default_categories[$ext];
         }
         if (empty($category)) {
             //do nothing if no category found
             I2CE::raiseError("No file category specified for ({$file_name}). Valid categories are:" . print_r($this->default_categories, true), E_USER_NOTICE);
             I2CE::raiseError(print_r($this->default_categories, true));
             return;
         }
     }
     if (!in_array($category, $this->allowedCategories)) {
         //we are not allowed to search this category
         I2CE::raiseError("Not allowed to search category ({$category}).  Allowed are:\n" . print_r($this->allowedCategories, true), E_USER_NOTICE);
         return;
     }
     $file_loc = I2CE::getFileSearch()->search($category, $file_name);
     $locale = I2CE::getFileSearch()->getLocaleOfLastSearch();
     if (!$file_loc) {
         //do nothing if we can't find the file
         I2CE::raiseError("Cannot find ({$file_name}). Search category is {$category} , Path is:\n" . print_r(I2CE::getFileSearch()->getSearchPath($category), true), E_USER_NOTICE);
         return;
     }
     if (!array_key_exists('apdContent', $vars)) {
         $vars['apdContent'] = null;
     }
     if (!array_key_exists('content', $vars)) {
         $vars['content'] = null;
     }
     //$headers = $this->doHeader($file_name,$file_loc,$ext,$vars['content'],$vars['apdContent']);
     $headers = $this->doHeader($file_name, $ext, $vars['content'], $vars['apdContent']);
     $config = I2CE::getConfig();
     $cacheTime = 600;
     // defaults to 10 minutes
     if (isset($config->modules->FileDump->cache_time)) {
         $cacheTime = $config->modules->FileDump->cache_time * 60;
     }
     $ttl = 3600;
     // defaults to one hour
     if ($config->is_scalar("/modules/FileDump/ttl")) {
         $ttl = $config->modules->FileDump->ttl * 60;
     }
     if (I2CE_Dumper::dumpContents($file_loc, $headers, $cacheTime)) {
         I2CE_Dumper::cacheFileLocation(MDB2::singleton()->database_name, $file_name, $locale, $headers, $file_loc, $cacheTime, $ttl);
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:65,代码来源:I2CE_FileDump.php

示例10: load_file

 protected function load_file($category, $file_name)
 {
     $file = I2CE::getFileSearch()->search($category, $file_name);
     if (!$file) {
         I2CE::raiseError("Cannot find file ({$file_name})", E_USER_ERROR);
     }
     $a = file($file);
     if (empty($a)) {
         I2CE::raiseError("File ({$file}) is empty", E_USER_ERROR);
     }
     return $a;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:12,代码来源:I2CE_PDF.php

示例11: read_post

 function read_post()
 {
     $f = $this->gotoTable('post');
     /*Table 72: 'post' table
      *Type Name Description
      *Fixed format Format of this table
      *Fixed italicAngle Italic angle in degrees
      *FWord underlinePosition Underline position
      *FWord underlineThickness Underline thickness
      *uint32 isFixedPitch Font is monospaced; set to 1 if the font is monospaced and 0 otherwise 
      *       (N.B., to maintain compatibility with older versions of the TrueType spec, accept 
      *        any non-zero value as meaning that the font is monospaced)
      *uint32 minMemType42 Minimum memory usage when a TrueType font is downloaded as a Type 42 font
      *uint32 maxMemType42 Maximum memory usage when a TrueType font is downloaded as a Type 42 font
      *uint32 minMemType1 Minimum memory usage when a TrueType font is downloaded as a Type 1 font
      *uint32 maxMemType1 Maximum memory usage when a TrueType font is downloaded as a Type 1 font
      */
     $format_pieces = $this->read_fixed_pieces();
     $this->setDirection('-1');
     $this->setFontCharacteristic('ItalicAngle', $this->read_fixed_pieces());
     //FIXME
     $this->setFontCharacteristic('UnderlinePosition', $this->read_FWord());
     $this->setFontCharacteristic('UnderlineThickness', $this->read_FWord());
     $this->setFixedWidth($this->read_uint32() > 0);
     $this->read_uint32();
     $this->read_uint32();
     $this->read_uint32();
     $this->read_uint32();
     switch ($format_pieces[2]) {
         case 1:
             //258 GIDs in the standard mac ordering
             die("UNFINISHED BUSINESS\n");
             break;
         case 2:
             switch ($format_pieces[1]) {
                 case 0:
                     //format is 2.0
                     //this is the useful one.
                     /* Format 2 is used for fonts that contain some glyphs not in the standard set or whose glyph 
                      *ordering is non-standard. The glyph name index array in this subtable maps the glyphs in this 
                      *font to a name index. If the name index is between 0 and 257, treat the name index as a glyph 
                      *index in the Macintosh standard order. If the name index is between 258 and 32767, then subtract 
                      *258 and use that to index into the list of Pascal strings at the end of the table. In this manner 
                      *a font may map some of its glyphs to the standard glyph names, and some to its own names
                      */
                     /*Table 73: 'post' format 2
                      *Type Name Description
                      *uint16 numberOfGlyphs number of glyphs
                      *uint16 glyphNameIndex[numberOfGlyphs] Ordinal number of this glyph in 'post' string tables. This is not an offset.
                      *Pascal string names[numberNewGlyphs] glyph names with length bytes [variable] (a Pascal string)
                      */
                     $num_glyphs = $this->read_uint16();
                     if ($num_glyphs != $this->num_glyphs) {
                         die("Glyph number mismatch!\n");
                     }
                     $glyphNameIndex = array();
                     $numberNewGlyphs = 0;
                     for ($gid = 0; $gid < $num_glyphs; $gid++) {
                         $nameIndex = $this->read_uint16();
                         $glyphNameIndex[$gid] = $nameIndex;
                         if (258 < $nameIndex) {
                             $numberNewGlyphs++;
                         }
                     }
                     $name = array();
                     $mac_ordering_file = I2CE::getFileSearch()->search('PDF_CORE', 'mac-ordering');
                     if (!$mac_ordering_file) {
                         die("Cannont find the file <mac-ordering>\n");
                     }
                     $a = $this->loadin($mac_ordering_file);
                     $n = 0;
                     foreach ($a as $l) {
                         $l = rtrim($l);
                         $e = explode(" ", $l);
                         $names[(int) $e[0]] = $e[1];
                         $n++;
                     }
                     if ($n != 258) {
                         die("Invalid number of encodings in {$mac_ordering_file}");
                     }
                     for ($n = 258; $n <= 258 + $numberNewGlyphs; $n++) {
                         //read in pascal strings.  these are strings that are prefixed with a
                         //byte value which is their length;
                         $str_len = $this->read_uint8();
                         $names[$n] = fread($f, $str_len);
                         //READ PASCAL STRING
                     }
                     //read in the file containing postisctip name /codepoint mapping
                     $glyphToCP = array();
                     $postscript_names_file = I2CE::getFileSearch()->search('PDF_CORE', 'glyphlist.txt');
                     if (!$postscript_names_file) {
                         die("Cannont find the file <glyphlist.txt>\n");
                     }
                     $a = $this->loadin($postscript_names_file);
                     foreach ($a as $l) {
                         $l = trim($l);
                         if (strpos($l, '#') === 0) {
                             continue;
                         }
                         $e = explode(";", rtrim($l));
//.........这里部分代码省略.........
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:101,代码来源:I2CE_FontMetricTTF.php

示例12: testGetFileSearch

 public function testGetFileSearch()
 {
     $fs = I2CE::getFileSearch();
     $this->assertTrue($fs instanceof I2CE_FileSearch);
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:5,代码来源:I2CE_PackagerTest.php

示例13: LoadHyphenDictionary

 /**
  *  Load the hyphenation dictionary.
  *
  *  The file is expected to be a 'mashed up' version of a .tex
  *  hyphenation dictionary geneareted by using substrings.pl
  *  as in the stand-along hyphenation code of
  *  http://lingucomponent.openoffice.org/hyphenator.html
  *  @param string $file file containing the dictionary
  */
 public function LoadHyphenDictionary($file)
 {
     /* we are working on the assumpition that $file is in ASCII  compatible ecoding */
     $found_file = I2CE::getFileSearch()->search('HYPHEN_PATH', $file);
     if (!$found_file) {
         die("Cannot find hyphenation file <{$file}>\n");
     }
     $f = fopen($found_file, 'rb');
     if (!$f) {
         die("Cannot open hyphenation file: <{$found_file}>");
     }
     $line = trim(fgets($f));
     //read in the characterset line
     if (!$line) {
         die("Empty hyphenation dictionary file/Cannot read: <{$found_file}>");
     }
     if (strpos($line, 'ISO8') === 0) {
         //we forgot a hyphen
         $character_set = 'ISO-' . substr($line, 3);
         //the character set of the  hyphenation dictionary
     } else {
         $character_set = $line;
     }
     $convert = false;
     $mb_encoding = $this->enc->getEncodingType();
     $convert = $mb_encoding == $character_set;
     $this->patterns = array();
     $this->trans = array();
     $nums = array();
     for ($i = 0; $i <= 9; $i++) {
         $nums[$i] = mb_convert_encoding("{$i}", $mb_encoding);
     }
     while ($line = trim(fgets($f))) {
         //read  in a line of the dictionary file
         if ($convert) {
             $line = mb_convert_encoding($line, $mb_encoding, $character_set);
         }
         if (mb_substr($line, 0, 1, $mb_encoding) != '%') {
             // this line is not a comment
             $pattern = array();
             $word = mb_convert_encoding('', $mb_encoding);
             $prev_char_was_letter = true;
             $line_len = mb_strlen($line, $mb_encoding);
             for ($i = 0; $i < $line_len; $i++) {
                 $curr_char = mb_substr($line, $i, 1, $mb_encoding);
                 $not_a_number = true;
                 $j = -1;
                 do {
                     $j++;
                     $not_a_number = $curr_char != $nums[$j];
                 } while ($j < 9 && $not_a_number);
                 if (!$not_a_number) {
                     $pattern[] = $j;
                     $prev_char_was_letter = false;
                 } else {
                     $word .= $curr_char;
                     if ($prev_char_was_letter) {
                         $pattern[] = 0;
                     }
                     $prev_char_was_letter = true;
                 }
             }
             if ($prev_char_was_letter) {
                 $pattern[] = 0;
             }
             $this->patterns[$word] = $pattern;
             $word_len = mb_strlen($word, $mb_encoding);
             for ($i = 1; $i <= $word_len; $i++) {
                 $this->trans[mb_substr($word, 0, $i)] = true;
             }
         }
     }
     fclose($f);
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:83,代码来源:I2CE_Hyphen.php

示例14: render

 /**
  *Abstract method to render the form. Makes sure all ducks are in a row
  * @returns boolean true on sucess.
  */
 public function render()
 {
     if (count($this->ids) != 1) {
         I2CE::raiseError("Exactly one ID must be specifed (currently)");
         return false;
     }
     if (!is_string($this->std_form) || strlen($this->std_form) == 0) {
         I2CE::raiseError("No standard printed form set");
         return false;
     }
     $this->stdConfig = I2CE::getConfig()->traverse('/modules/PrintedForms/forms/' . $this->std_form, false);
     if (!$this->stdConfig instanceof I2CE_MagicDataNode) {
         I2CE::raiseError("No standard printed form   /modules/PrintedForms/forms/" . $this->std_form);
         return false;
     }
     if (!$this->stdConfig->setIfIsSet($relationship, 'relationship')) {
         I2CE::raiseError("No relationship set");
         return false;
     }
     try {
         $this->rel = new I2CE_FormRelationship($relationship, $this->base_rel_config);
     } catch (Exception $e) {
         I2CE::raiseError("Could not instatiate relationship {$relationship}");
         return false;
     }
     $template = false;
     $template_upload = false;
     if ($this->stdConfig->setIfIsSet($template_upload, 'template_upload', true) && array_key_exists('content', $template_upload) && $template_upload['content'] && array_key_exists('name', $template_upload) && $template_upload['name']) {
         $name = $template_upload['name'];
         $pos = strrpos($name, '.');
         if ($pos !== false) {
             $name = substr($name, 0, $pos);
         }
         $this->template_file = tempnam(sys_get_temp_dir(), basename($name . '_')) . '.odt';
         file_put_contents($this->template_file, $template_upload['content']);
     } else {
         if ($this->stdConfig->setIfIsSet($template, 'template')) {
             $this->template_file = I2CE::getFileSearch()->search('ODT_TEMPLATES', $template);
             if (!$this->template_file) {
                 I2CE::raiseError("No template file found from {$template}");
                 return false;
             }
         } else {
             I2CE::raiseError("No template  set");
             return false;
         }
     }
     $template_contents = new ZipArchive();
     if ($template_contents->open($this->template_file) !== TRUE) {
         I2CE::raiseError("Could not extract odt file");
         return;
     }
     $this->template_vars = array();
     for ($i = 0; $i < $template_contents->numFiles; $i++) {
         $stats = $template_contents->statIndex($i);
         if ($stats['name'] != 'content.xml') {
             continue;
         }
         $matches = array();
         //pull out all the template variables for processing.
         preg_match_all('/{{{([0-9a-zA-Z_\\-\\+\\,\\=\\.]+(\\(.*?\\))?)}}}/', $template_contents->getFromIndex($i), $matches, PREG_SET_ORDER);
         foreach ($matches as $match) {
             if (!is_array($match) || count($match) < 2 || !is_string($match[1]) || strlen($match[1]) == 0) {
                 continue;
             }
             $this->template_vars[] = $match[1];
         }
         $this->template_vars = array_unique($this->template_vars);
     }
     $this->content = $this->stdConfig->getAsArray('content');
     $forms = array();
     foreach ($this->ids as $id) {
         if (!is_string($id)) {
             continue;
         }
         $fs = $this->rel->getFormsSatisfyingRelationship($id);
         if (!is_array($fs) || count($fs) == 0) {
             continue;
         }
         $forms[$id] = $fs;
     }
     if (count($forms) == 0) {
         I2CE::raiseError("No valid forms");
         return false;
     }
     $this->forms = $forms;
     $textProps = array();
     I2CE::longExecution();
     $success = $this->_render($textProps);
     return $success;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:95,代码来源:I2CE_PrintedForm_Render_ODT.php

示例15: usage

* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have 
* received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
* @version 2.1
* @access public
*/
$translations_dir = "translations" . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR;
$usage[] = "Looks for .pot files in {$translations_dir}\n";
$set_categories = false;
$set_configs = false;
require_once "translate_base.php";
@(require_once "Archive/Tar.php");
if (!class_exists('Archive_Tar')) {
    usage('Please install the PEAR Archive_Tar package');
}
I2CE::setupFileSearch(array('MODULES' => getcwd()));
$fileSearch = I2CE::getFileSearch();
$module = $configurator->findAvailableConfigs($fileSearch, false);
if (count($module) != 1) {
    usage("No Modules Specified");
}
$module = $module[0];
$out_dir = 'translations' . DIRECTORY_SEPARATOR . 'launchpad';
$archive_file = $out_dir . DIRECTORY_SEPARATOR . 'templates-' . $module . '.tgz';
if ($translations_dir[strlen($translations_dir) - 1] == DIRECTORY_SEPARATOR) {
    $translations_dir = substr($translations_dir, 0, -1);
}
if (!is_dir($translations_dir) || !is_readable($translations_dir)) {
    usage("Could not find/read {$translations_dir} directory");
}
if (!is_dir($out_dir)) {
    if (!mkdir($out_dir, 0775, true)) {
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:31,代码来源:create_launchpad_upload.php


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