Example #1
0
	function getMessageByID($id = 0)
	{
   		$this->db->where('message_id',id_clean($id));
		$Q = $this->db->get('is_contact_us');
		if ($Q->num_rows() > 0){
	      	$data = $Q->row_array();
	    }
	    $Q->free_result();    
	    return $data;
	}
 function updateEmployee()
 {
     $birthday = isset($_POST['birthday']) ? $_POST['birthday'] : '0-0-0';
     $array_birth = explode('-', $birthday);
     $enterday = isset($_POST['enterday']) ? $_POST['enterday'] : '0-0-0';
     $array_enter = explode('-', $enterday);
     $data = array('name' => db_clean($_POST['name']), 'dept_id' => id_clean($_POST['dept_id']), 'position' => db_clean($_POST['position']), 'mobile' => db_clean($_POST['mobile']), 'telephone' => db_clean($_POST['telephone']), 'address' => db_clean($_POST['address']), 'zipcode' => db_clean($_POST['zipcode']), 'birth_year' => id_clean($array_birth[0]), 'birth_month' => id_clean($array_birth[1]), 'birth_day' => id_clean($array_birth[2]), 'enter_year' => id_clean($array_enter[0]), 'enter_month' => id_clean($array_enter[1]), 'enter_day' => id_clean($array_enter[2]), 'idcard' => db_clean($_POST['idcard']), 'graduateschool' => db_clean($_POST['graduateschool']), 'education' => db_clean($_POST['education']));
     $this->db->where('id', $_POST['id']);
     $this->db->update('yz_employees', $data);
 }
Example #3
0
    function updateSubscriber()
    {
    	$data = array( 
    		'name' => db_clean($_POST['name']),
    		'email' => db_clean($_POST['email'])
    	);
     	$this->db->where('id', id_clean($_POST['id']));
    	$this->db->update('omc_subscribers', $data);	

    }
Example #4
0
 function getMessage($id)
 {
     $data = array();
     $options = array('id' => id_clean($id));
     $Q = $this->db->getwhere('shoutbox', $options, 1);
     if ($Q->num_rows() > 0) {
         $data = $Q->row_array();
     }
     $Q->free_result();
     return $data;
 }
Example #5
0
 function checkOrphans($id)
 {
     $data = array();
     $this->db->where('customer_id', id_clean($id));
     $Q = $this->db->get('omc_order');
     if ($Q->num_rows() > 0) {
         foreach ($Q->result_array() as $key => $row) {
             $data[$key] = $row;
         }
         $Q->free_result();
         return $data;
     }
 }
Example #6
0
 function _fields()
 {
     $data = array(
         'name'          =>  db_clean($_POST['name']),
         'shortdesc'     =>  db_clean($_POST['shortdesc']),
         'status'        =>  db_clean($_POST['status'],8),
         'parentid'      =>  id_clean($_POST['parentid']),
         'order'         =>  id_clean($_POST['order'],10),
         'page_uri_id'   =>  db_clean($_POST['page_uri_id']),
         'lang_id'       =>  db_clean($_POST['lang_id']),
         'menu_id'       =>  db_clean($_POST['menu_id'])
     );
     // $this->MKaimonokago->addItem($this->module, $data);
     return $data;
 }
Example #7
0
	function checkOrphans($id)
    {
        $data = array();
        $this->db->where('kho_id',id_clean($id));
        $Q = $this->db->get('shop_kho');
        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data[] = $row;
            }
        $Q->free_result();
        return $data;
        }
    }
Example #8
0
 function _fields()
 {
     $data = array(
     'name'        => db_clean($_POST['name']),
     'metadesc'    => db_clean($_POST['metadesc']),
     'metakeyword' => db_clean($_POST['metakeyword']),
     'shortdesc'   => db_clean($_POST['shortdesc']),
     'longdesc'    => $this->input->post('longdesc'),
     'status'      => db_clean($_POST['status'],8),
     'parentid'    => id_clean($_POST['parentid']),
     'lang_id'     => id_clean($_POST['lang_id']),
     'order'       => id_clean($_POST['order'],10),
     'table_id'    => id_clean($_POST['table_id'])
     );
     // $this->MKaimonokago->addItem($this->module, $data);
     return $data;
 }
Example #9
0
 function updateUser()
 {
     $data = array('username' => db_clean($_POST['username']), 'password' => md5($_POST['password']), 'email' => db_clean($_POST['email']), 'group' => id_clean($_POST['group']), 'status' => id_clean($_POST['status']));
     $this->db->where('uid', $_POST['uid']);
     $this->db->update('yz_users', $data);
     /* 		$this->db->where('roleid', $_POST['roleid']);
     		$this->db->delete('yz_role_action');
     			
     		$actions= $_POST['actionItems'];
     		$array_actions=explode(',',$actions);
     		if (count($array_actions)){
     			foreach ($array_actions  as $value){
     				$data = array('roleid' => $_POST['roleid'],
     						'actionid' => intval($value));
     				$this->db->insert('yz_role_action',$data);
     			}
     		} */
 }
Example #10
0
	function getOrder($id)
    {
        $data = array();
		$data = array();
		
    	//$this->db->order_by('table_id','asc');
        $Q = $this->db->query('SELECT statusSrc.value as statusSrcStr, statusDst.value as statusDstStr, is_order.* FROM is_order 
								LEFT JOIN is_order_status as statusSrc on is_order.status_src = statusSrc.id 
								LEFT JOIN is_order_status as statusDst  on is_order.status_dst = statusDst.id
								WHERE is_order.order_id = '.id_clean($id));
        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data[] = $row;
            }
        }
        $Q->free_result();
        
        if(count($data) > 0)
        	return $data[0];
        else 
        	return null;	
    }
Example #11
0
/**
 * usded in customer/controllers/, slideshow/controllers/, menus, products, pages, playroom category,
 * @param <type> $module
 * @param <type> $data
 */


    function updateItem($module,$data)
    {
        $module_table = 'omc_'.$module;
        if($module =='customer')
        {// omc_cutomer has customer_id
            $idname = 'customer_id';
            $this->db->where($idname, id_clean($_POST['customer_id']));
        }
        else
        {
            $idname = 'id';
            $this->db->where($idname, id_clean($_POST['id']));
        }
	   $this->db->update($module_table, $data);
    }
Example #12
0
		function deleteUser($id)
		{
 	 		$data = array('status' => 'inactive');
 	 		$this->db->where('id', id_clean($id));
	 		$this->db->update('admins', $data);
		}
Example #13
0
 function changeCatStatus($id)
 {
     // getting status of page
     $catinfo = array();
     $catinfo = $this->getCategory($id);
     $status = $catinfo['status'];
     if($status =='active')
     {
     	$data = array('status' => 'inactive');
     	$this->db->where('id', id_clean($id));
     	$this->db->update('omc_category', $data);	
     }
     else
     {
     	$data = array('status' => 'active');
     	$this->db->where('id', id_clean($id));
     	$this->db->update('omc_category', $data);	
     }
 }
Example #14
0
		function verifyCart()
		{
			$cart = $_SESSION['cart'];
			$change = false;
			$idlist = array();
			$final = array();
			
			if (count($cart))
			{
				foreach ($cart as $id => $details)
				{
					$idlist[] = id_clean($id);
				}
				$ids = implode(",", $idlist);
				$this->db->select('id, price');
				$this->db->where("id in ($ids)");
				$Q = $this->db->get('products');
				if ($Q->num_rows() > 0)
				{
					foreach ($Q->result_array() as $row)
					{
						$db[$row['id']] = $row['price'];
					}
				}
				foreach ($cart as $id => $details)
				{
					if (isset($db[$id]))
					{
						if ($details['price'] != $db[$id])
						{
							$details['price'] = $db[$id];
							$change = true;
						}
						$final[$id] = $details;
					}
					else
					{
						$change = true;
					}
				}
				
				$totalprice = 0;
				foreach ($final as $id => $product)
				{
					$totalprice += $product['price'] * $product['count'];
				}
				
				$_SESSION['totalprice'] = $this->format_currency($totalprice);
				$_SESSION['cart'] = $final;
				$this->session->set_flashdata('change', $change);
			}
			else
			{
				//nothing in cart!
				$this->session->set_flashdata('error', "Nothing in cart! Please notify help@example.com to report this problem during checkout.");
			}
		}
Example #15
0
		function checkOrphans($id)
		{
			$data = array();
			$this->db->select('id, name');
			$this->db->where('category_id', id_clean($id));
			$Q = $this->db->get('products');
			if ($Q->num_rows() > 0)
			{
				foreach ($Q->result_array() as $row)
				{
					$data[$row['id']] = $row['name'];
				}
			}
			
			$Q->free_result();  
    		return $data; 
		}
Example #16
0
 function _field()
 {
     $data = array('name' => db_clean($_POST['name']), 'shortdesc' => db_clean($_POST['shortdesc']), 'longdesc' => db_clean($_POST['longdesc'], 5000), 'thumbnail' => db_clean($_POST['thumbnail']), 'image' => db_clean($_POST['image']), 'product_order' => db_clean($_POST['product_order']), 'class' => db_clean($_POST['class'], 30), 'grouping' => db_clean($_POST['grouping'], 16), 'status' => db_clean($_POST['status'], 8), 'category_id' => id_clean($_POST['category_id']), 'featured' => db_clean($_POST['featured'], 20), 'other_feature' => db_clean($_POST['other_feature'], 20), 'price' => db_clean($_POST['price'], 16), 'lang_id' => db_clean($_POST['lang_id']), 'table_id' => db_clean($_POST['table_id']));
     return $data;
 }
Example #17
0
 function checkOrphans($id)
 {
     $data = array();
     $this->db->select('order_item_id,name');
     $this->db->where('order_id', id_clean($id));
     $Q = $this->db->get('omc_order_item');
     if ($Q->num_rows() > 0) {
         return TRUE;
     } else {
         return FALSE;
     }
     $Q->free_result();
 }
Example #18
0
 function getAssignedSizes($id)
 {
     // not using anymore
     /**
     * products_sizes table has table_id and size_id fields
     * This will be the same as getAssignedColors() function above
     * It will returns size_id where table_id is $id
     * e.g product id=7 may have size_id 2,3,4 etc
     */
     $data = array();
     $this->db->select('size_id');
     $this->db->where('product_id',id_clean($id));
     $Q = $this->db->get('omc_product_sizes');
     if ($Q->num_rows() > 0)
     {
         foreach ($Q->result_array() as $row)
         {
             $data[] = $row['size_id'];
         }
     }
     $Q->free_result();
     return $data;
 }
Example #19
0
		function deletePage($id)
		{
			$data = array('status' => 'inactive');
			$this->db->where('id', id_clean($id));
			$this->db->update('pages', $data);
		}
Example #20
0
 function updateMaterial()
 {
     $data = array('name' => db_clean($_POST['name']), 'group_id' => id_clean($_POST['group']), 'guige' => db_clean($_POST['guige']), 'unit' => db_clean($_POST['unit']), 'unit_price' => db_clean($_POST['unit_price']), 'supplier_id' => id_clean($_POST['supplier']), 'low_store_alert' => $_POST['low_store_alert'], 'current_store' => $_POST['current_store']);
     $this->db->where('id', $_POST['id']);
     $this->db->update('yz_materials', $data);
 }
Example #21
0
 /**
  * If you delete a category, you may be creating product orphans.
  * Find in omc_product table, select product id and name where product's
  * category_id is $id
  * 
  * original code
  * $this->db->select('id,name');
  * $this->db->where('category_id',id_clean($id));
  * $Q = $this->db->get('omc_product');
  * 
  * $id is the id number i.e. 6 or 12
  * $orphan_id is the name of id i.e products_id where you are looking for orphans
  * $db_table is the name of table omc_product etc
  *
  * If I use (in mcats, instead of checkOrphans($id) )
  * or in morders, $id will be order id
  * When I delete an order there might be order-item orphans
  * When I delete an product there might be order-item orphans
  * When I delete a customer there might be order orphans
  * 
  */
 
    function findOrphans($id, $orphan_id, $db_table)
    {
        // delete a customer from omc_customer table
        // if $db_table is omc_customer, this will create customer_id
        // then find customer_id in omc_order table to find orphans
        /**
        * delete an order from omc_order table. this will create order_items orphans in omc_order_item
        * find order_item where order_id is 
        * 
        *
        */
        $tablename = explode("-", $db_table);
        $tableid = $tablename[1]."_id";
        // or
        // $id_name = preg_replace('/.*_(.*)/', '${1}_id', $db_table);
        $data = array();
        // $this->db->select($tableid.',name'); 
        $this->db->select($tableid,'name');
        $this->db->where($orphan_id,id_clean($id));
        $Q = $this->db->get($db_table);
        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data[$row['id']] = $row['name'];
            }
        }
        $Q->free_result();  
        return $data;  	
    }
Example #22
0
 function checkMenuOrphans($id, $table=NULL)
 {
     $data = array();
     $this->db->select('id,name');
     $this->db->where('parentid',id_clean($id));
     if(!empty ($table))
     {
         $Q = $this->db->get($table);
     }  
     else 
     {
         $Q = $this->db->get('omc_menus');
     }
     if ($Q->num_rows() > 0)
     {
         foreach ($Q->result_array() as $row)
         {
             $data[$row['id']] = $row['name'];
         }
     }
     $Q->free_result();  
     return $data;  	
 }
Example #23
0
	function updateNewsByID($id = 0, $data)
	{
   		$this->db->where('id',id_clean($id));
   		$this->db->set('date', 'NOW()', FALSE);
		$this->db->update("is_news",$data);
	}
Example #24
0
 function _fields()
 {
     $data = array('name' => db_clean($_POST['name']), 'shortdesc' => db_clean($_POST['shortdesc']), 'longdesc' => db_clean($_POST['longdesc'], 5000), 'status' => db_clean($_POST['status'], 8), 'parentid' => id_clean($_POST['parentid']), 'lang_id' => id_clean($_POST['lang_id']), 'table_id' => id_clean($_POST['table_id']));
     // $this->MKaimonokago->addItem($this->module, $data);
     return $data;
 }
Example #25
0
 function updateEvent()
 {
     $data = array('eventDate' => db_clean($_POST['date']), 'eventTitle' => db_clean($_POST['eventTitle']), 'eventContent' => db_clean($_POST['eventContent']));
     $this->db->where('id', id_clean($_POST['id']));
     $this->db->update('eventcal', $data);
 }
Example #26
0
 function updatePage()
 {
     $data = array('name' => db_clean($_POST['name']), 'keywords' => db_clean($_POST['keywords']), 'description' => db_clean($_POST['description']), 'status' => db_clean($_POST['status'], 8), 'path' => db_clean($_POST['path']), 'content' => $_POST['content']);
     $this->db->where('id', id_clean($_POST['id']));
     $this->db->update('omc_pages', $data);
 }
Example #27
0
		function getRandomProducts($limit, $skip)
		{
			$data = array();
			if ($limit == 0)
			{
				$limit = 3;
			}
			$this->db->select('id, name, thumbnail, category_id');
			$this->db->where('id !=', id_clean($skip));
			$this->db->where('status', 'active');
			$this->db->order_by('rand()');
			$this->db->limit(100);
			$Q = $this->db->get('products');
			if ($Q->num_rows() > 0)
			{
				foreach ($Q->result_array() as $row)
				{
					$data[$row['category_id']] = array(
						"id" => $row['id'], 
						"name" => $row['name'], 
						"category_id" => $row['category_id'], 
						"thumbnail" => $row['thumbnail']
					);
					if (count($data) >= $limit)
					{
						break;
					}
				}
			}
			
			$Q->free_result();
			return $data;
		}