示例#1
0
 public static function sendNoticeOfUpdatedUser($user)
 {
     $obj = new ObjectBase();
     $obj->verifyType($user, "User");
     $to = $user->getEmail();
     $from = self::$ADMIN;
     $subject = "Account Updated";
     $message = "\n\nYou have successfully updated your account information. If you have any questions\nregarding this change, or experience difficulties using your account, send a message\nto our IT peeps and they'll get your everything sorted out.\n\nIT: " . self::$ADMIN . "\n";
     return self::sendEmail($from, $to, null, $subject, $message);
 }
示例#2
0
 public function delete()
 {
     if (parent::delete()) {
         $this->cleanPositions();
         return Db::getInstance()->exec('DELETE FROM `' . DB_PREFIX . '`product_to_feature WHERE `id_feature`=' . (int) $this->id);
     }
 }
示例#3
0
文件: CMS.php 项目: yiuked/tmcart
 public function delete()
 {
     if (parent::delete()) {
         Db::getInstance()->exec('DELETE FROM `' . DB_PREFIX . 'cms_to_category` WHERE `id_cms`=' . (int) $this->id);
     }
     return true;
 }
示例#4
0
文件: Cart.php 项目: yiuked/tmcart
 public function delete()
 {
     if (parent::delete()) {
         return Db::getInstance()->exec('DELETE FROM ' . DB_PREFIX . 'cart_product WHERE id_cart=' . (int) $this->id);
     }
     return false;
 }
示例#5
0
文件: Tag.php 项目: JeCat/framework
 public function __construct($sName, Attributes $aAttrs = null, $nType, $nPosition, $nEndPosition, $nLine, $sSource)
 {
     $this->sName = $sName;
     $this->nType = $nType;
     $this->aAttrs = $aAttrs ? $aAttrs : new Attributes();
     parent::__construct($nPosition, $nEndPosition, $nLine, $sSource);
 }
 public function applyJSON(array $json)
 {
     parent::applyJSON($json);
     $this->applyProperty($json, 'max_custom_fields');
     $this->applyProperty($json, 'custom_fields', NULL, CustomField::class, TRUE);
     $this->applyProperty($json, 'standard_fields', NULL, CustomField::class, TRUE);
 }
示例#7
0
 public function update($nullValues = false)
 {
     $this->level_depth = $this->calcLevelDepth();
     return parent::update();
     if (!isset($this->doNotRegenerateNTree) or !$this->doNotRegenerateNTree) {
         self::regenerateEntireNtree();
         $this->recalculateLevelDepth($this->id_category);
     }
 }
示例#8
0
文件: Image.php 项目: yiuked/tmcart
 public function delete()
 {
     if (!parent::delete()) {
         return false;
     }
     if (!$this->deleteImage()) {
         return false;
     }
     return true;
 }
示例#9
0
文件: Order.php 项目: yiuked/tmcart
 public function update($nullValues = false)
 {
     if ($this->id_order_status == 2) {
         $products = $this->cart->getProducts();
         foreach ($products as $row) {
             Product::updateOrders($row['id_product']);
         }
     }
     return parent::update();
 }
 public function applyJSON(array $json)
 {
     parent::applyJSON($json);
     $this->applyProperty($json, 'id');
     $this->applyProperty($json, 'display_name');
     $this->applyProperty($json, 'description');
     $this->applyProperty($json, 'required');
     $this->applyProperty($json, 'type');
     $this->applyProperty($json, 'enum_values');
 }
示例#11
0
文件: Product.php 项目: yiuked/tmcart
 public function delete()
 {
     if (parent::delete()) {
         Db::getInstance()->exec('DELETE FROM `' . DB_PREFIX . 'product_to_category` WHERE `id_product`=' . (int) $this->id);
         Db::getInstance()->exec('DELETE FROM `' . DB_PREFIX . 'product_to_tag` WHERE `id_product`=' . (int) $this->id);
         Db::getInstance()->exec('DELETE FROM `' . DB_PREFIX . 'product_to_image` WHERE `id_product`=' . (int) $this->id);
         Db::getInstance()->exec('DELETE FROM `' . DB_PREFIX . 'product_to_attribute` WHERE `id_product`=' . (int) $this->id);
         $this->deleteImages();
     }
     return true;
 }
示例#12
0
文件: Paylog.php 项目: yiuked/tmcart
 public function getFields()
 {
     parent::validation();
     if (isset($this->id)) {
         $fields['id_pay'] = (int) $this->id;
     }
     $fields['id_cart'] = (int) $this->id_cart;
     $fields['code'] = pSQL($this->code);
     $fields['msg'] = pSQL($this->msg);
     $fields['add_date'] = pSQL($this->add_date);
     return $fields;
 }
示例#13
0
 public function delete()
 {
     if (parent::delete()) {
         $ret = true;
         $attributes = $this->getAttributes();
         foreach ($attributes as $attribute) {
             $attr = new Attribute((int) $attribute['id_attribute']);
             $ret &= $attr->delete();
         }
         return $ret;
     }
 }
示例#14
0
文件: Rule.php 项目: yiuked/tmcart
 public function getFields()
 {
     parent::validation();
     if (isset($this->id)) {
         $fields['id_rule'] = (int) $this->id;
     }
     $fields['id_entity'] = (int) $this->id_entity;
     $fields['entity'] = pSQL($this->entity);
     $fields['view_name'] = pSQL($this->view_name);
     $fields['rule_link'] = pSQL($this->rule_link);
     return $fields;
 }
示例#15
0
 public function statusSelection($ids, $action)
 {
     $rating_fields = array("one_star", "two_star", "three_star", "four_star", "five_star");
     parent::statusSelection($ids, $action);
     $result = Db::getInstance()->getAll('SELECT * FROM ' . DB_PREFIX . 'feedback WHERE id_feedback IN(' . pSQL(implode(',', $ids)) . ')');
     foreach ($result as $row) {
         $field = pSQL($rating_fields[$row["rating"] - 1]);
         if ($this->feedbackStateExists($row['id_product'])) {
             Db::getInstance()->exec('UPDATE ' . DB_PREFIX . 'feedback_state SET times=times+1,total_rating=total_rating+' . (int) $row["rating"] . ",`" . $field . "`=`" . $field . "`+1\n\t\t\t\tWHERE id_product=" . intval($row['id_product']));
         } else {
             Db::getInstance()->exec('INSERT INTO ' . DB_PREFIX . 'feedback_state SET id_product=' . intval($row['id_product']) . ',times=1,total_rating=' . (int) $row["rating"] . ",`" . $field . "`=`" . $field . "`+1");
         }
     }
     return true;
 }
示例#16
0
 public function applyJSON(array $json)
 {
     parent::applyJSON($json);
     $this->applyProperty($json, 'id');
     $this->applyProperty($json, 'account');
     $this->applyProperty($json, 'created_at');
     $this->applyProperty($json, 'description');
     $this->applyProperty($json, 'favorite');
     $this->applyProperty($json, 'limit');
     $this->applyProperty($json, 'name');
     $this->applyProperty($json, 'reference_id');
     $this->applyProperty($json, 'search');
     $this->applyProperty($json, 'type');
     $this->applyProperty($json, 'updated_at');
     $this->applyProperty($json, 'video_ids');
 }
示例#17
0
文件: Text.php 项目: JeCat/framework
 public function separateChildren()
 {
     if (!($sSource = parent::source()) or !$this->count()) {
         return;
     }
     $arrNewChildren = array();
     $nIdx = $this->position();
     foreach ($this->iterator() as $aChild) {
         $nLen = $aChild->position() - $nIdx;
         if ($nLen) {
             $arrNewChildren[] = new Text($nIdx, $nIdx + $nLen - 1, $this->line(), substr($sSource, $nIdx - $this->position(), $nLen));
         }
         $arrNewChildren[] = $aChild;
         $nIdx = $aChild->endPosition() + 1;
         $this->remove($aChild);
     }
     if ($this->endPosition() >= $nIdx) {
         $arrNewChildren[] = new Text($nIdx, $this->endPosition(), $this->line(), substr($sSource, $nIdx - $this->position()));
     }
     foreach ($arrNewChildren as $aChild) {
         $this->add($aChild);
     }
     $this->setSource('');
 }
示例#18
0
文件: Mark.php 项目: JeCat/framework
 public function __construct($sMarkType, $nPosition, $nEndPosition, $nLine, $sSource)
 {
     ObjectBase::__construct($nPosition, $nEndPosition, $nLine, $sSource);
     $this->sMarkType = $sMarkType;
 }
示例#19
0
 /**
  * Constructs a new Rotten Tomatoes movie object.
  *
  * @param \PalantirNet\RottenTomatoes\Connection $connection
  *   The Rotten Tomatoes connection this object came from.
  * @param array $data
  *   The data of this object.
  * @param int $id
  *   The ID of this movie in Rotten Tomatoes.
  */
 public function __construct(Connection $connection, $data, $id)
 {
     parent::__construct($connection, $data);
     $this->id = $id;
 }
示例#20
0
 public function Sprzet_Oprogramowanie($attributes)
 {
     DBG::log(__CLASS__, __FUNCTION__, 'before:', get_object_vars($this));
     parent::init($attributes);
     DBG::log(__CLASS__, __FUNCTION__, 'after:', get_object_vars($this));
 }
示例#21
0
 public function delete()
 {
     if (parent::delete()) {
         return Db::getInstance()->exec('DELETE FROM `' . DB_PREFIX . '`product_to_attribute WHERE `id_attribute`=' . (int) $this->id);
     }
 }
示例#22
0
 /**
  *  Selects any number of rows from a database table.
  *
  *  @param {string} table The table to target.
  *  @param {key=>value} values Key-value pairs identifying which
  *          database fields you want returned.
  *  @param {key=>value} target Key-value pairs identifying the
  *          columns and values you are targeting.
  *  @param {array(string,int)} orderby=NULL This is an array of
  *          size 2.
  *          index 0: The column to order by
  *          index 1: DatabaseUser::ORDER_BY_ASC or
  *                   DatabaseUser::ORDER_BY_DESC
  *  @param {resource} dbhandle=false Optional database
  *          connection handle.
  *  @return {array{key=>value}} Each entry of the returned array
  *          contains a single row indexed by column name. For
  *          example, if you expect your query to return a single
  *          row [$result = selectRows(...)], and you want to
  *          access the value for 'firstName', use the following
  *          syntax:
  *              $result[0]["firstName"]
  */
 public function selectRows($table, $values, $target, $orderby = NULL, $mapper = NULL, $dbhandle = false)
 {
     $target_size = count($target);
     $values_size = count($values);
     if ($values_size == 0) {
         return false;
     }
     $values = self::encodeValues($values);
     $target = self::encodeValues($target);
     $query = "SELECT ";
     foreach ($values as $key => $value) {
         $values[$key] = $value . " AS '" . $value . "'";
     }
     $query .= implode(', ', $values);
     $query .= " FROM {$table}";
     if ($target_size > 0) {
         $query .= " WHERE ";
         $key_values = array();
         foreach ($target as $key => $value) {
             $key_values[] = $key . "=" . $value;
         }
         $query .= implode(" AND ", $key_values);
     }
     if (!is_null($orderby) && is_array($orderby) && count($orderby) == 2) {
         $query .= " ORDER BY " . $orderby[0];
         if ($orderby[1] == self::ORDER_BY_ASC) {
             $query .= " ASC";
         }
         if ($orderby[1] == self::ORDER_BY_DESC) {
             $query .= " DESC";
         }
     }
     Logger::debug(get_class(), __FUNCTION__, $query);
     if (is_null($mapper)) {
         return self::sendQuery($query, $dbhandle);
     } else {
         parent::verifyType($mapper, "Mapper");
         $results = self::sendQuery($query, $dbhandle);
         $mappedObjs = array();
         foreach ($results as $result) {
             $mappedObjs[] = $mapper->mapResult($result);
         }
         return $mappedObjs;
     }
 }
示例#23
0
 public static function compareTo($thisRange, $thatRange)
 {
     $objBase = new ObjectBase();
     $objBase->verifyType($thisRange, "Range");
     $objBase->verifyType($thatRange, "Range");
     if ($thisRange->lessThan($thatRange)) {
         return -1;
     } else {
         if ($thisRange->greaterThan($thatRange)) {
             return 1;
         } else {
             return 0;
         }
     }
 }
示例#24
0
 public function __construct(Connection $connection, array $cast, array $links = array())
 {
     $data = array('cast' => $cast, 'links' => $links);
     parent::__construct($connection, $data);
     $this->cast = $this->createCast($this->data['cast']);
 }
示例#25
0
 public function __construct()
 {
     parent::__construct();
     $this->type = self::TYPE;
 }
示例#26
0
 public static function compareTo($thisUser, $thatUser)
 {
     $objBase = new ObjectBase();
     $objBase->verifyType($thisUser, "User");
     $objBase->verifyType($thatUser, "User");
     return strcmp($thisUser->getEmail(), $thatUser->getEmail());
 }