function mrr_display_quick_links_edit()
{
	$tab="";
	
	$cur_user=$_SESSION['selected_user_id'];
	$cur_cust=$_SESSION['selected_merchant_id'];
	$cur_store=$_SESSION['selected_store_id'];
	
	if($cur_user==0)		$cur_user=$_SESSION['user_id'];
	
	$merch_adder="";
	if($cur_cust > 0)
	{
		$merch_adder="
			 and (
			 	quick_links.merchant_id=0
			 	or
			 	quick_links.merchant_id='".sql_friendly($cur_cust)."'
			 	or
			 	LOCATE(',".sql_friendly($cur_cust).",',merchant_id_list) >0
			 )
		";	
	}
	
	$store_adder="";
	if($cur_cust > 0)
	{
		$store_adder="
			 and (
			 	quick_links.store_id=0
			 	or
			 	quick_links.store_id='".sql_friendly($cur_store)."'
			 	or
			 	LOCATE(',".sql_friendly($cur_store).",',store_id_list) >0
			 )
		";	
	}	
	
	$tab.="<div id='cce_quick_links_editor'><div id='cce_quick_links_editor_pad' style='display:none;'>";
	
	//new quick link form...
	
	//get_merchant_select_box($field,$pre=0,$cd=0,$prompt="",$classy="")
     $selbox1=get_merchant_select_box('quick_link_0_cust',$cur_cust,0,"ALL"," class='all_quick_link_input'");          
     
     //get_store_select_box($field,$pre=0,$merchant=0,$cd=0,$prompt="",$classy="")
     $selbox2=get_store_select_box('quick_link_0_store',$cur_store,$cur_cust,0,"ALL"," class='all_quick_link_input'");    
	
	$tab.="<div id='quick_links_0_block' class='all_quick_link_edits'>";
	$tab.=	"<div>
				&nbsp;
				&nbsp;
				&nbsp;				
				<span class='mrr_quick_links_spacer' style='color:#e19918;'>NEW</span>&nbsp;
			</div>";		
	$tab.=	"<span>Link Name</span> <input type='text' name='quick_link_0_name' id='quick_link_0_name' value=\"\" class='all_quick_link_input'>";
	$tab.=	"<span>Web Address</span> <input type='text' name='quick_link_0_url' id='quick_link_0_url' value=\"\" class='all_quick_link_input'><br>";
	$tab.=	"<span>Customer</span> ".$selbox1."<br>";	
	$tab.=	"<span>Store</span> ".$selbox2."<br>";		
	$tab.=	"<span>&nbsp;</span> <label>Make Private <input type='checkbox' name='quick_link_0_private' id='quick_link_0_private' value=\"1\"></label>";
	$tab.="</div>";
	
	
	$sql="
		select quick_links.*
		from quick_links		
		where quick_links.deleted=0
			".$merch_adder."
			".$store_adder."
			and (
				quick_links.private_link=0
				or
				(quick_links.private_link=1 && quick_links.user_id='".sql_friendly($cur_user)."')
			)
		order by quick_links.position_id asc,
			quick_links.row_num asc, 
			quick_links.col_num asc, 
			quick_links.link_name asc, 
			quick_links.id asc
		";
	$data=simple_query($sql);	
	while($row = mysqli_fetch_array($data))
	{		
		$allow_removal="";
		if($row['user_id']==$_SESSION['user_id'] || $row['access_level'] <= $_SESSION['access_level'])
		{
			$allow_removal="<i class='fa fa-trash' style='color:#e19918; font-size:14px;' title='Click to remove this merchant' onClick='edit_quick_links(".$row['id'].",3);'></i>";	
		}
		
		$selbox1=get_merchant_select_box('quick_link_'.$row['id'].'_cust',$cur_cust,0,"ALL"," class='all_quick_link_input' onChange='edit_quick_links(".$row['id'].",6);'");          
          $selbox2=get_store_select_box('quick_link_'.$row['id'].'_store',$cur_store,$cur_cust,0,"ALL"," class='all_quick_link_input' onChange='edit_quick_links(".$row['id'].",7);'");    
		
		$tab.="<div id='quick_links_".$row['id']."_block' class='all_quick_link_edits'>";
		$tab.=	"<div>
					<img src='common/images/prev_orange.png' alt='' border='0' style='cursor:pointer;height:16px' onClick='edit_quick_links(".$row['id'].",1);'>
					".$row['position_id']." 
					<img src='common/images/next_orange.png' alt='' border='0' style='cursor:pointer;;height:16px' onClick='edit_quick_links(".$row['id'].",2);'>
					<span class='mrr_quick_links_spacer'>".$allow_removal."</span>&nbsp;
				</div>";		
		$tab.=	"<span>Link Name</span> <input type='text' name='quick_link_".$row['id']."_name' id='quick_link_".$row['id']."_name' value=\"".$row['link_name']."\" class='all_quick_link_input' onBlur='edit_quick_links(".$row['id'].",4);'>";
		$tab.=	"<span>Web Address</span> <input type='text' name='quick_link_".$row['id']."_url' id='quick_link_".$row['id']."_url' value=\"".$row['link_url']."\" class='all_quick_link_input' onBlur='edit_quick_links(".$row['id'].",5);'><br>";
		$tab.=	"<span>Customer</span> ".$selbox1."<br>";		//".$row['merchant_id'].": ".$row['merchant_id_list']."
		$tab.=	"<span>Store</span> ".$selbox2."<br>";			//".$row['store_id'].": ".$row['store_id_list']."
		$tab.=	"<span>&nbsp;</span> <label>Make Private <input type='checkbox' name='quick_link_".$row['id']."_private' id='quick_link_".$row['id']."_private' value=\"1\"".($row['private_link'] > 0 ? " checked" : "")." onClick='edit_quick_links(".$row['id'].",8);'></label>";
		$tab.="</div>";
		
		//<input type='text' name='quick_link_".$row['id']."_cust' id='quick_link_".$row['id']."_cust' value=\"".$row['merchant_id'].": ".$row['merchant_id_list']."\">
		//<input type='text' name='quick_link_".$row['id']."_store' id='quick_link_".$row['id']."_store' value=\"".$row['store_id'].": ".$row['store_id_list']."\">
	}     
	$tab.="</div></div>";
	return $tab;
}
Example #2
0
	function load_dynamic_user_store_select()
	{
		$field_name=trim($_POST['field_name']);
		$pre=$_POST['id'];
		$cd=$_POST['cd'];
		$prompt=trim($_POST['prompt']);
		$classy=$_POST['class_text'];
		
		$bypass_session=0;
		$merchant=0;
		if($_SESSION['selected_merchant_id'] > 0)		$merchant=$_SESSION['selected_merchant_id'];
		if($_SESSION['selected_store_id'] > 0)			$pre=$_SESSION['selected_store_id'];
		
		if($_POST['id'] < 0)		$pre=0;	
				
		$tab=get_store_select_box($field_name,$pre,$merchant,$cd,$prompt,$classy,$bypass_session);
		
		display_xml_response("<rslt>1</rslt><mrrTab><![CDATA[".$tab."]]></mrrTab>");		
	}