Esempio n. 1
0
 /**
  * Sets the primary table name and retrieves the table schema.
  *
  * @param \Zend\Db\Table\AbstractTable $adapter
  * @return \Zend\Db\Select This \Zend\Db\Select object.
  */
 public function setTable(AbstractTable $table)
 {
     $this->_adapter = $table->getAdapter();
     $this->_info = $table->info();
     $this->_table = $table;
     return $this;
 }
Esempio n. 2
0
 /**
  * Constructor
  *
  * Instantiate a TTF 'maxp' table object.
  *
  * @param  \Pop\Pdf\Build\Font\TrueType $font
  * @return Maxp
  */
 public function __construct(\Pop\Pdf\Build\Font\TrueType $font)
 {
     parent::__construct($this->allowed);
     $bytePos = $font->tableInfo['maxp']->offset + 4;
     $ary = unpack('nnumberOfGlyphs/', $font->read($bytePos, 2));
     $this->numberOfGlyphs = $ary['numberOfGlyphs'];
 }
Esempio n. 3
0
 public function prepareQuery()
 {
     parent::prepareQuery();
     $this->query .= " where name='website' OR name='link'";
     if (isset($this->name) && !empty($this->name)) {
         $this->query .= " OR name = '" . $this->name . "';";
     }
 }
 function __construct()
 {
     try {
         parent::__construct();
     } catch (ADODB_Exception $e) {
         throw new Exception("Database Connection Error");
     }
 }
Esempio n. 5
0
 function __construct($t_cust_account_id)
 {
     if (!empty($t_cust_account_id)) {
         $this->fromClause = sprintf($this->fromClause, "and a.t_cust_account_id = " . $t_cust_account_id);
     } else {
         $this->fromClause = sprintf($this->fromClause, 'and a.t_cust_account_id = -999');
     }
     parent::__construct();
 }
Esempio n. 6
0
 public function save($new = false)
 {
     if (parent::save($new)) {
         $_SESSION['usr']['upd'] = 1;
         return true;
     } else {
         return false;
     }
 }
Esempio n. 7
0
 /**
  * Constructor
  *
  * Instantiate a TTF 'cmap' table object.
  *
  * @param  \Pop\Pdf\Build\Font\TrueType $font
  * @return Cmap
  */
 public function __construct(\Pop\Pdf\Build\Font\TrueType $font)
 {
     parent::__construct($this->allowed);
     $bytePos = $font->tableInfo['cmap']->offset;
     // Get the CMAP header data.
     $cmapTableHeader = unpack('ntableVersion/' . 'nnumberOfTables', $font->read($bytePos, 4));
     $this->header = new \ArrayObject($cmapTableHeader, \ArrayObject::ARRAY_AS_PROPS);
     $this->parseSubTables($font);
 }
Esempio n. 8
0
 function __construct($role_id = '')
 {
     if (!empty($role_id)) {
         $this->role_id = (int) $role_id;
         $this->fromClause = sprintf($this->fromClause, 'AND p_role_menu.role_id = ' . $this->role_id);
     } else {
         $this->fromClause = sprintf($this->fromClause, '');
     }
     parent::__construct();
 }
Esempio n. 9
0
 /**
  * Added to filter dates to SQL format
  *
  * @param mixed $array
  * @param array $ignore
  * @return $this
  */
 public function bind($array, $ignore = array())
 {
     //transform date to SQL
     if (!empty($array['start_date'])) {
         $array['start_date'] = $this->dateToSql($array['start_date']);
     }
     if (!empty($array['end_date'])) {
         $array['end_date'] = $this->dateToSql($array['end_date']);
     }
     return parent::bind($array, $ignore);
 }
Esempio n. 10
0
 /**
  * Constructor
  *
  * Instantiate a TTF 'post' table object.
  *
  * @param  \Pop\Pdf\Build\Font\TrueType $font
  * @return Post
  */
 public function __construct(\Pop\Pdf\Build\Font\TrueType $font)
 {
     parent::__construct($this->allowed);
     $bytePos = $font->tableInfo['post']->offset + 4;
     $italicBytes = $font->read($bytePos, 4);
     $this->italicAngle = $font->readFixed(16, 16, $italicBytes);
     $bytePos += 8;
     $ary = unpack('nfixed/', $font->read($bytePos, 2));
     $ary = $font->shiftToSigned($ary);
     $this->fixed = $ary['fixed'];
 }
Esempio n. 11
0
 /**
  * Constructor
  *
  * Instantiate a TTF 'hhea' table object.
  *
  * @param  \Pop\Pdf\Build\Font\TrueType $font
  * @return Hhea
  */
 public function __construct(\Pop\Pdf\Build\Font\TrueType $font)
 {
     parent::__construct($this->allowed);
     $bytePos = $font->tableInfo['hhea']->offset + 4;
     $ary = unpack('nascent/' . 'ndescent', $font->read($bytePos, 4));
     $ary = $font->shiftToSigned($ary);
     $this->ascent = $font->toEmSpace($ary['ascent']);
     $this->descent = $font->toEmSpace($ary['descent']);
     $bytePos = $font->tableInfo['hhea']->offset + 34;
     $ary = unpack('nnumberOfHMetrics/', $font->read($bytePos, 2));
     $this->numberOfHMetrics = $ary['numberOfHMetrics'];
 }
Esempio n. 12
0
 /**
  * Constructor
  *
  * Instantiate a TTF 'hmtx' table object.
  *
  * @param  \Pop\Pdf\Build\Font\TrueType $font
  * @return Hmtx
  */
 public function __construct(\Pop\Pdf\Build\Font\TrueType $font)
 {
     parent::__construct($this->allowed);
     $bytePos = $font->tableInfo['hmtx']->offset;
     for ($i = 0; $i < $font->numberOfHMetrics; $i++) {
         $ary = unpack('nglyphWidth/', $font->read($bytePos, 2));
         $this->glyphWidths[$i] = $font->shiftToSigned($ary['glyphWidth']);
         $bytePos += 4;
     }
     while (count($this->glyphWidths) < $font->numberOfGlyphs) {
         $this->glyphWidths[] = end($this->glyphWidths);
     }
 }
Esempio n. 13
0
 /** {@inheritdoc} */
 public function addColumnObject($column)
 {
     // PostgreSQL creates columns without comment. Adjust $column so that
     // setComment() knows that it must still be added.
     $comment = $column->getComment();
     $column->setComment(null);
     $newColumn = parent::addColumnObject($column);
     if ($comment) {
         $newColumn->setComment($comment);
         $column->setComment($comment);
     }
     return $newColumn;
 }
Esempio n. 14
0
 /**
  * Constructor
  *
  * Instantiate a TTF 'loca' table object.
  *
  * @param  \Pop\Pdf\Build\Font\TrueType $font
  * @return Loca
  */
 public function __construct(\Pop\Pdf\Build\Font\TrueType $font)
 {
     parent::__construct($this->allowed);
     $bytePos = $font->tableInfo['loca']->offset;
     $format = $font->header->indexToLocFormat == 1 ? 'N' : 'n';
     $byteLength = $font->header->indexToLocFormat == 1 ? 4 : 2;
     $multiplier = $font->header->indexToLocFormat == 1 ? 1 : 2;
     for ($i = 0; $i < $font->numberOfGlyphs + 1; $i++) {
         $ary = unpack($format . 'offset', $font->read($bytePos, $byteLength));
         $this->offsets[$i] = $ary['offset'] * $multiplier;
         $bytePos += $byteLength;
     }
 }
Esempio n. 15
0
 /**
  * Constructor
  *
  * Instantiate a TTF 'name' table object.
  *
  * @param  \Pop\Pdf\Build\Font\TrueType $font
  * @return Name
  */
 public function __construct(\Pop\Pdf\Build\Font\TrueType $font)
 {
     $font->tableInfo['name']->header = new \ArrayObject(unpack('nformatSelector/' . 'nnameRecordsCount/' . 'nstorageOffset', $font->read($font->tableInfo['name']->offset, 6)), \ArrayObject::ARRAY_AS_PROPS);
     $bytePos = $font->tableInfo['name']->offset + 6;
     for ($j = 0; $j < $font->tableInfo['name']->header->nameRecordsCount; $j++) {
         $ttfRecord = unpack('nplatformId/' . 'nencodingId/' . 'nlanguageId/' . 'nnameId/' . 'nlength/' . 'noffset', $font->read($bytePos, 12));
         $ttfRecordOffset = $bytePos + 12;
         $nextBytePos = $font->tableInfo['name']->offset + $font->tableInfo['name']->header->storageOffset + $ttfRecord['offset'];
         $ttfValue = $font->read($nextBytePos, $ttfRecord['length']);
         if ($ttfRecord['platformId'] != 1) {
             $ttfValue = @iconv('UTF-16be', 'UTF-8//TRANSLIT', $ttfValue);
         }
         if ($ttfValue != '' && isset($ttfRecord['nameId']) && isset($this->names[$ttfRecord['nameId']])) {
             $this->allowed[$this->names[$ttfRecord['nameId']]] = $ttfValue;
         }
         $bytePos = $ttfRecordOffset;
     }
     parent::__construct($this->allowed);
 }
Esempio n. 16
0
 /**
  * Constructor
  *
  * Instantiate a TTF 'head' table object.
  *
  * @param  \Pop\Pdf\Build\Font\TrueType $font
  * @return Head
  */
 public function __construct(\Pop\Pdf\Build\Font\TrueType $font)
 {
     $bytePos = $font->tableInfo['head']->offset;
     $tableVersionNumberBytes = $font->read($bytePos, 4);
     $tableVersionNumber = $font->readFixed(16, 16, $tableVersionNumberBytes);
     $bytePos += 4;
     $fontRevisionBytes = $font->read($bytePos, 4);
     $fontRevision = $font->readFixed(16, 16, $fontRevisionBytes);
     $versionArray = ['tableVersionNumber' => $tableVersionNumber, 'fontRevision' => $fontRevision];
     $bytePos += 4;
     $headerArray = unpack('NcheckSumAdjustment/' . 'NmagicNumber/' . 'nflags/' . 'nunitsPerEm', $font->read($bytePos, 12));
     $bytePos += 28;
     $bBox = unpack('nxMin/' . 'nyMin/' . 'nxMax/' . 'nyMax', $font->read($bytePos, 8));
     $bBox = $font->shiftToSigned($bBox);
     $bytePos += 14;
     $indexToLocFormat = unpack('nindexToLocFormat', $font->read($bytePos, 2));
     $headerArray['indexToLocFormat'] = $font->shiftToSigned($indexToLocFormat['indexToLocFormat']);
     $this->allowed = array_merge($versionArray, $headerArray, $bBox);
     parent::__construct($this->allowed);
 }
Esempio n. 17
0
 /**
  * __construct() - For concrete implementation of Zend_Db_Table
  *
  * @param string|array $config string can reference a \Zend\Registry key for a db adapter
  *                             OR it can reference the name of a table
  * @param array|\Zend\Db\Table\Definition $definition
  */
 public function __construct($config = array(), $definition = null)
 {
     if ($definition !== null && is_array($definition)) {
         $definition = new Definition($definition);
     }
     if (is_string($config)) {
         if (\Zend\Registry::isRegistered($config)) {
             trigger_error(__CLASS__ . '::' . __METHOD__ . '(\'registryName\') is not valid usage of Zend_Db_Table, ' . 'try extending Zend_Db_Table_Abstract in your extending classes.', E_USER_NOTICE);
             $config = array(self::ADAPTER => $config);
         } else {
             // process this as table with or without a definition
             if ($definition instanceof Definition && $definition->hasTableConfig($config)) {
                 // this will have DEFINITION_CONFIG_NAME & DEFINITION
                 $config = $definition->getTableConfig($config);
             } else {
                 $config = array(self::NAME => $config);
             }
         }
     }
     parent::__construct($config);
 }
Esempio n. 18
0
 /**
  * Constructor
  *
  * Instantiate a OTF 'OS/2' table object.
  *
  * @param  \Pop\Pdf\Build\Font\TrueType $font
  * @return Os2
  */
 public function __construct(\Pop\Pdf\Build\Font\TrueType $font)
 {
     parent::__construct($this->allowed);
     $this->flags = new \ArrayObject(['isFixedPitch' => false, 'isSerif' => false, 'isSymbolic' => false, 'isScript' => false, 'isNonSymbolic' => false, 'isItalic' => false, 'isAllCap' => false, 'isSmallCap' => false, 'isForceBold' => false], \ArrayObject::ARRAY_AS_PROPS);
     $bytePos = $font->tableInfo['OS/2']->offset + 8;
     $ary = unpack("nfsType", $font->read($bytePos, 2));
     $this->embeddable = $ary['fsType'] != 2 && ($ary['fsType'] & 0x200) == 0;
     $bytePos = $font->tableInfo['OS/2']->offset + 30;
     $ary = unpack("nfamily_class", $font->read($bytePos, 2));
     $familyClass = $font->shiftToSigned($ary['family_class']) >> 8;
     if ($familyClass >= 1 && $familyClass <= 5 || $familyClass == 7) {
         $this->flags->isSerif = true;
     } else {
         if ($familyClass == 8) {
             $this->flags->isSerif = false;
         }
     }
     if ($familyClass == 10) {
         $this->flags->isScript = true;
     }
     if ($familyClass == 12) {
         $this->flags->isSymbolic = true;
         $this->flags->isNonSymbolic = false;
     } else {
         $this->flags->isSymbolic = false;
         $this->flags->isNonSymbolic = true;
     }
     // Unicode bit-sniffing may not be necessary.
     $bytePos += 3;
     $ary = unpack('NunicodeRange1/' . 'NunicodeRange2/' . 'NunicodeRange3/' . 'NunicodeRange4', $font->read($bytePos, 16));
     if ($ary['unicodeRange1'] == 1 && $ary['unicodeRange2'] == 0 && $ary['unicodeRange3'] == 0 && $ary['unicodeRange4'] == 0) {
         $this->flags->isSymbolic = false;
         $this->flags->isNonSymbolic = true;
     }
     $bytePos = $font->tableInfo['OS/2']->offset + 76;
     $ary = unpack("ncap/", $font->read($bytePos, 2));
     $this->capHeight = $font->toEmSpace($font->shiftToSigned($ary['cap']));
 }
Esempio n. 19
0
 /**
  * Prepares a table reference for lookup.
  *
  * Ensures all reference keys are set and properly formatted.
  *
  * @param \Zend\Db\Table\AbstractTable $dependentTable
  * @param \Zend\Db\Table\AbstractTable $parentTable
  * @param string                 $ruleKey
  * @return array
  */
 protected function _prepareReference(AbstractTable $dependentTable, AbstractTable $parentTable, $ruleKey)
 {
     $parentTableName = get_class($parentTable) === 'Zend_Db_Table' ? $parentTable->getDefinitionConfigName() : get_class($parentTable);
     $map = $dependentTable->getReference($parentTableName, $ruleKey);
     if (!isset($map[AbstractTable::REF_COLUMNS])) {
         $parentInfo = $parentTable->info();
         $map[AbstractTable::REF_COLUMNS] = array_values((array) $parentInfo['primary']);
     }
     $map[AbstractTable::COLUMNS] = (array) $map[AbstractTable::COLUMNS];
     $map[AbstractTable::REF_COLUMNS] = (array) $map[AbstractTable::REF_COLUMNS];
     return $map;
 }
Esempio n. 20
0
 function __construct()
 {
     parent::__construct();
 }
Esempio n. 21
0
 /**
  * Constructor
  *
  * Instantiate a TTF 'glyf' table object.
  *
  * @param  \Pop\Pdf\Build\Font\TrueType $font
  * @return Glyf
  */
 public function __construct(\Pop\Pdf\Build\Font\TrueType $font)
 {
     parent::__construct($this->allowed);
     $locaLength = count($font->tables['loca']->offsets);
     $j = 0;
     foreach ($font->tables['loca']->offsets as $offset) {
         $bytePos = $font->tableInfo['glyf']->offset + $offset;
         $ary = unpack('nnumberOfContours/' . 'nxMin/' . 'nyMin/' . 'nxMax/' . 'nyMax', $font->read($bytePos, 10));
         $ary = $font->shiftToSigned($ary);
         $ary['xMin'] = $font->toEmSpace($ary['xMin']);
         $ary['yMin'] = $font->toEmSpace($ary['yMin']);
         $ary['xMax'] = $font->toEmSpace($ary['xMax']);
         $ary['yMax'] = $font->toEmSpace($ary['yMax']);
         $ary['width'] = $ary['xMin'] + $ary['xMax'];
         $this->glyphWidths[] = $ary['width'];
         $bytePos += 10;
         $ary['endPtsOfContours'] = [];
         $ary['instructionLength'] = null;
         $ary['instructions'] = null;
         $ary['flags'] = null;
         // The simple and composite glyph descriptions may not be necessary.
         // If simple glyph.
         if ($ary['numberOfContours'] > 0) {
             for ($i = 0; $i < $ary['numberOfContours']; $i++) {
                 $ar = unpack('nendPt', $font->read($bytePos, 2));
                 $ary['endPtsOfContours'][$i] = $ar['endPt'];
                 $bytePos += 2;
             }
             $ar = unpack('ninstructionLength', $font->read($bytePos, 2));
             $ary['instructionLength'] = $ar['instructionLength'];
             $bytePos += 2;
             if ($ary['instructionLength'] > 0) {
                 for ($i = 0; $i < $ary['instructionLength']; $i++) {
                     $byte = $font->read($bytePos, 1);
                     if (strlen($byte) != 0) {
                         $ar = unpack('Cinstruction', $byte);
                         $ary['instructions'][$i] = $ar['instruction'];
                         $bytePos++;
                     } else {
                         $ary['instructions'][$i] = null;
                     }
                 }
             }
             $bytePos++;
             $byte = $font->read($bytePos, 1);
             if (strlen($byte) != 0) {
                 $ar = unpack('Cflags', $byte);
                 $ary['flags'] = $ar['flags'];
             } else {
                 $ary['flags'] = 0;
             }
             if ($j < $locaLength - 1) {
                 $this->glyphs[] = $ary;
             }
             // Stopped here. Still need to get the x & y coordinates of the simple glyph.
             // Else, if composite glyph.
         } else {
             if ($j < $locaLength - 1) {
                 // Composite glyph goes here.
             }
         }
         $j++;
     }
 }
Esempio n. 22
0
 /**
  * Constructor.
  * 
  * @param string $version The backup version.
  * @param resource $db The database handler.
  * @param int $course_id The ID of this course.
  * @param string $import_dir The directory where the backup was unzipped to.
  * @param array $old_id_to_new_id Reference to either the parent ID's or to store current ID's.
  * 
  */
 function ContentTable($version, $db, $course_id, $import_dir, &$old_id_to_new_id)
 {
     // special case for `content` -- we need the max ordering
     $sql = 'SELECT MAX(ordering) AS ordering FROM ' . TABLE_PREFIX . 'content WHERE content_parent_id=0 AND course_id=' . $course_id;
     $result = mysql_query($sql, $db);
     $ordering = mysql_fetch_assoc($result);
     $this->ordering = $ordering['ordering'] + 1;
     parent::AbstractTable($version, $db, $course_id, $import_dir, $old_id_to_new_id);
 }