Ejemplo n.º 1
0
	/**
	* @param string The name of the form element
	* @param string The value of the element
	* @param CBSimpleXMLElement  $node The xml element for the parameter
	* @param string The control name
	* @return string The html for the element
	*/
	function _form_radio( $name, $value, &$node, $control_name ) {
		$options = array();
		foreach ( $node->children() as $option ) {
			if ( $option->attributes( 'index' ) ) {
				$val = $option->attributes( 'index' );
			} else {
				$val = $option->attributes( 'value' );
			}
			$text = CBTxt::T( getLangDefinition($option->data()) );
			$options[] = moscomprofilerHTML::makeOption( $val, $text );
		}
		return moscomprofilerHTML::radioList( $options, ''. $this->control_name( $control_name, $name ) . '', '', 'value', 'text', $value );			//TBD missing id :  id="' . $this->control_id( $control_name, $name ) . '"
	}
Ejemplo n.º 2
0
 function _getFormattedNewsletters($rows, $linesStyle, $name = _UE_NEWSLETTER_NAME, $desc = _UE_NEWSLETTER_DESCRIPTION)
 {
     $htmltext = array();
     $htmltext[] = moscomprofilerHTML::makeOption('1', _UE_NEWSLETTER_HTML . "   ");
     $htmltext[] = moscomprofilerHTML::makeOption('0', _UE_NEWSLETTER_TEXT);
     $return = "<div class='newslettersList'>" . "<table style='width:100%; border:0px;' cellspacing='0' cellpadding='0'>\n";
     if (!$linesStyle) {
         $return .= "\t<tr>\n" . "\t\t<th class='captionCell'>" . $name . "</th>\n" . "\t\t<th class='captionCell'>" . $desc . "</th>\n" . "\t</tr>\n";
     }
     foreach ($rows as $row) {
         $return .= "\t<tr>\n";
         $return .= "\t\t<td style='width:" . ($linesStyle ? "2%" : "30%") . ";' class='fieldCell'>";
         $return .= "<input type='checkbox' style='margin-right: 8px;' name='newsLitems[]' value=\"" . $row->id . "\" ";
         if ($row->subscribed) {
             $return .= 'checked="checked" ';
         }
         $return .= "/> ";
         if ($linesStyle) {
             $return .= "</td>\n\t\t<td style='width:98%;' class='fieldCell'>";
         }
         $return .= "<span class='captionCell'>" . getLangDefinition($row->list_name) . "</span>";
         if ($row->subscribed && !$row->confirmed) {
             $return .= "<br /><span class='fieldError'>(" . _UE_NEWSLETTER_NOT_CONFIRMED . ")</span>";
         }
         if ($linesStyle) {
             $return .= "<br />";
         } else {
             $return .= "</td>\n\t\t<td class='fieldCell'>";
         }
         $return .= "<span class='fieldCell'>" . getLangDefinition($row->list_desc) . "</span>" . "</td>\n";
         $return .= "\t</tr>\n";
     }
     $return .= "\t<tr>\n\t\t<td class='captionCell' colspan='2'>" . "<span class='captionCell' id='newsLettersFormatTitle'>" . _UE_NEWSLETTER_FORMAT_TITLE . ":" . "</span>" . "</td>\n\t</tr>\n";
     $return .= "\t<tr>\n\t\t<td style='width:20%;' class='fieldCell'" . ($linesStyle ? " colspan='2'" : "") . ">";
     $return .= "<span class='fieldCell' id='newsLettersFormatField'>" . _UE_NEWSLETTER_FORMAT_FIELD . "</span>";
     if ($linesStyle) {
         $return .= "&nbsp;&nbsp;";
     } else {
         $return .= "</td>\n\t\t<td class='fieldCell'>";
     }
     $return .= moscomprofilerHTML::radioList($htmltext, 'newsLhtml', 'class="inputbox" size="1"', 'value', 'text', $rows[0]->receive_html);
     $return .= "</td>\n";
     $return .= "\t</tr>\n";
     $return .= "</table>";
     $return .= "</div>";
     return $return;
 }
Ejemplo n.º 3
0
	/**
	* Generates the HTML to display the user edit tab
	* @param object tab reflecting the tab database entry
	* @param object mosUser reflecting the user being displayed
	* @param int 1 for front-end, 2 for back-end
	* @returns mixed : either string HTML for tab content, or false if ErrorMSG generated
	*/
	function getEditTab($tab,$user,$ui) {
        global $_CB_framework;
        
		//fix to hide edit tab from front-end!
		//if ($ui==1) return;
		
		// Get all relevant tab parameters - these settings are global and set by the admin
		$tabparams = $this->_pgGetTabParameters($user);
		//print_r($tabparams);
        $isModerator=isModerator($_CB_framework->myId());


		if ($ui==1 && $tabparams["pgallowuserenable"]!=1 && $tabparams["cbpgenable"]!=1 && !$isModerator) {
			return null;
		}
		
        $testfeature = 0; // test feature setting to allow backend running total edits set this to 1;
        
		$return		=	$this->_writeTabDescription( $tab, $user );

		$return .= "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n";
		
		// Short Greeting:
		$return .= "<tr>\n";
		$return .= "	<td class=\"titleCell\">" . CBTxt::Th("Short Greeting") . ":</td>\n";
		$return .= "	<td class=\"fieldCell\"><input class=\"inputbox\" type=\"text\" name=\"".$this->_getPGparamName("cb_pgshortgreeting")."\" mosReq=\"0\" mosLabel=\"" . htmlspecialchars(CBTxt::T("Short Greeting")) . "\" value=\"".cbUnHtmlspecialchars($user->cb_pgshortgreeting)."\" size=\"40\" />";
		$return .= getFieldIcons($ui, false, true, CBTxt::Th("Enter a short greeting for your gallery viewers"), CBTxt::Th("Short Greeting").":");
		$return .= "</td></tr>\n";

		$lists = array();

		// make the select list for the special gallery yes/no fields (normally 1=yes, 0=no)
		$yesno = array();
		$yesno[] = moscomprofilerHTML::makeOption( '_UE_YES', _CMN_YES );	// 1
		$yesno[] = moscomprofilerHTML::makeOption( '_UE_NO', _CMN_NO );	// 0

		// Enable Gallery:
        // logic is:    that backend can edit cb field but frontend can only edit if parameter is set to allow or if moderator is viewing
        //              
		if ($tabparams["pgallowuserenable"] || $ui==2 || $isModerator) { 
			$lists['_pg_EnableProfileGallery'] = moscomprofilerHTML::radioList( $yesno, $this->_getPGparamName("cb_pgenable"), 'class="inputbox" size="1" mosReq="0" mosLabel="' . htmlspecialchars(CBTxt::T("Enable Gallery")).'"', 'value', 'text', $user->cb_pgenable);
			$return .= "<tr>\n";
			$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Enable Gallery") . ":</td>\n";
			$return .= "  <td class=\"fieldCell\">".$lists['_pg_EnableProfileGallery'];
			$return .= getFieldIcons($ui, false, false, CBTxt::Th("Select Yes or No to turn-on or off the Gallery Tab"),CBTxt::Th("Enable Gallery") . ":");
			$return .= "</td>\n</tr>\n";
		}

		// Enable Autopublish Items:
		if ($tabparams["pgallowautopublishoverride"] || $ui==2 || $isModerator) {
			$lists['_pg_AutoPublish'] = moscomprofilerHTML::radioList( $yesno, $this->_getPGparamName("cb_pgautopublish"), 'class="inputbox" size="1" mosReq="0" mosLabel="' . htmlspecialchars(CBTxt::T("Autopublish items")).'"', 'value', 'text', $user->cb_pgautopublish);
			$return .= "<tr>\n";
			$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Autopublish items") . ":</td>\n";
			$return .= "  <td class=\"fieldCell\">";
			if ($tabparams["pgautopublish"]) {
				$return .= $lists['_pg_AutoPublish'];
			} else {
				$return .= ($tabparams["cbpgautopublish"] ? _CMN_YES : _CMN_NO);
			}
			$return .= getFieldIcons($ui, false, false, CBTxt::Th("Select Yes or No to autopublish or not newly uploaded gallery items"), CBTxt::Th("Autopublish items").":");
			$return .= "</td>\n</tr>\n";
		}

		// Auto-approve Items setting in backend or frontend for moderators:
		if ( ($ui == 2 && $tabparams["pgallowautoapproveoverride"]) || ($isModerator && $tabparams["pgallowautoapproveoverride"]) ) {
			$lists['_pg_AutoApprove'] = moscomprofilerHTML::radioList( $yesno, $this->_getPGparamName("cb_pgautoapprove"), 'class="inputbox" size="1" mosReq="0" mosLabel="' . htmlspecialchars(CBTxt::T("Automatically approve")) . '"', 'value', 'text', $user->cb_pgautoapprove);
			$return .= "<tr>\n";
			$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Automatically approve") . ":</td>\n";
			$return .= "  <td class=\"fieldCell\">". $lists['_pg_AutoApprove'];
			$return .= getFieldIcons($ui, false, false,CBTxt::Th("This value can be set by the admin to over-ride the gallery plugin backend default approval parameter"), CBTxt::Th("Automatically approve") . ":");
			$return .= "</td>\n</tr>\n";
		}
		// Storage Quota setting only in backend or frontend for moderators:
		if (isset($user->cb_pgtotalquotasize) && $user->cb_pgtotalquotasize) {
			$quota = $user->cb_pgtotalquotasize;
		} else {
			$quota = $tabparams["pgdefaultquota"];
		}
		$return .= "<tr>\n";
		$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Storage Quota (KB)") . ":</td>\n";
		$return .= "  <td class=\"fieldCell\">";
		if ($ui == 2 || $isModerator) {
			$return .= "<input class=\"inputbox\" type=\"text\" name=\"".$this->_getPGparamName("cb_pgtotalquotasize")."\" mosReq=\"0\" mosLabel=\"" . htmlspecialchars(CBTxt::T("Storage Quota (KB)")) . "\" value=\"".(isset($user->cb_pgtotalquotasize) ? $user->cb_pgtotalquotasize : null)."\" size=\"10\" />";
			$return .= " (" . CBTxt::Th("Default setting") . ": ".$tabparams["pgdefaultquota"].")";

		} else {
			$return .= $quota;
		}
		$return .= getFieldIcons($ui, false, false, CBTxt::Th("This value can be set by the admin to over-ride the gallery plugin backend default user quota"), CBTxt::Th("Storage Quota (KB)") . ":");
		$return .= "</td>\n</tr>\n";
		
		// Uploaded Items Quota setting only in backend or frontend for moderators:
		if (isset($user->cb_pgtotalquotaitems) && $user->cb_pgtotalquotaitems) {
			$quota = $user->cb_pgtotalquotaitems;
		} else {
			$quota = $tabparams["pgnumberofgalleryitems"];
		}
		$return .= "<tr>\n";
		$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Item Quota") . ":</td>\n";
		$return .= "  <td class=\"fieldCell\">";
		if ($ui == 2 || $isModerator) {
			$return .= "<input class=\"inputbox\" type=\"text\" name=\"".$this->_getPGparamName("cb_pgtotalquotaitems")."\" mosReq=\"0\" mosLabel=\"" . htmlspecialchars(CBTxt::T("Item Quota")) . "\" value=\"".(isset($user->cb_pgtotalquotaitems) ? $user->cb_pgtotalquotaitems : null)."\" size=\"10\" />";
			$return .= " (" . CBTxt::Th("Default setting").": ".$tabparams["pgnumberofgalleryitems"].")";

		} else {
			$return .= $quota;
		}
		$return .= getFieldIcons($ui, false, false, CBTxt::Th("The admin may use this to over-ride the default value of allowable items for each profile owner"), CBTxt::Th("Item Quota") . ":");
		$return .= "</td>\n</tr>\n";
		
		// Single Uploaded Item Maximum Size setting only in backend or frontend for moderators:
		if (isset($user->cb_pguploadsize) && $user->cb_pguploadsize) {
			$quota = $user->cb_pguploadsize;
		} else {
			$quota = $tabparams["pgmaxsize"];
		}
		$return .= "<tr>\n";
		$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Max single upload (KB)") . ":</td>\n";
		$return .= "  <td class=\"fieldCell\">";
		if ($ui == 2 || $isModerator) {
			$return .= "<input class=\"inputbox\" type=\"text\" name=\"".$this->_getPGparamName("cb_pguploadsize")."\" mosReq=\"0\" mosLabel=\"" . htmlspecialchars(CBTxt::T("Max single upload (KB)")) . "\" value=\"".(isset($user->cb_pguploadsize) ? $user->cb_pguploadsize : null)."\" size=\"10\" />";
			$return .= " (" . CBTxt::Th("Default setting") . ": ".$tabparams["pgmaxsize"].")";

		} else {
			$return .= $quota;
		}
		$return .= getFieldIcons($ui, false, false, CBTxt::Th("This value can be set by the admin to over-ride the gallery plugin backend default maximum single upload size"), CBTxt::Th("Max single upload (KB)") . ":");
		$return .= "</td>\n</tr>\n";
		
		// Current Item Count Usage (information field only):
		if (isset($user->cb_pgtotalitems) && $user->cb_pgtotalitems) {
			$quota = $user->cb_pgtotalitems;
		} else {
			$quota = "0";
		}
		$return .= "<tr>\n";
		$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Current Items") . ":</td>\n";
		$return .= "  <td class=\"fieldCell\">";
		
		if ($ui == 2 && $testfeature) {
			$return .= "<input class=\"inputbox\" type=\"text\" name=\"".$this->_getPGparamName("cb_pgtotalitems")."\" mosReq=\"0\" mosLabel=\"" . htmlspecialchars(CBTxt::T("Current Items")) . "\" value=\"".(isset($user->cb_pgtotalitems) ? $user->cb_pgtotalitems : 0)."\" size=\"10\" />";
		} else {
			$return .= $quota;
		}
		$return .= getFieldIcons($ui, false, false, CBTxt::Th("Keeps track of number of stored items"), CBTxt::Th("Current Items").":");
		$return .= "</td>\n</tr>\n";
		
		// Current Item Size Usage (information field only):
		if (isset($user->cb_pgtotalsize) && $user->cb_pgtotalsize) {
			$quota = $user->cb_pgtotalsize;
		} else {
			$quota = "0";
		}
		$return .= "<tr>\n";
		$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Current Storage") . ":</td>\n";
		$return .= "  <td class=\"fieldCell\">";
		if ($ui == 2 && $testfeature) {
			$return .= "<input class=\"inputbox\" type=\"text\" name=\"".$this->_getPGparamName("cb_pgtotalsize")."\" mosReq=\"0\" mosLabel=\"" . htmlspecialchars(CBTxt::T("Current Storage"))."\" value=\"".(isset($user->cb_pgtotalsize) ? $user->cb_pgtotalsize : 0)."\" size=\"10\" />";
		} else {
			$return .= $quota;
		}
		$return .= getFieldIcons($ui, false, false, CBTxt::Th("This field keeps track of the total size of all uploaded gallery items - like a quota usage field. Value is in bytes"), CBTxt::Th("Current Storage").":");
		$return .= "</td>\n</tr>\n";

		// Last Update (information field only):
		if (isset($user->cb_pglastupdate) && $user->cb_pglastupdate) {
			$quota = cbFormatDate($user->cb_pglastupdate);
		} else {
			$quota = _UE_NEVER;
		}
		$return .= "<tr>\n";
		$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Last Update") . ":</td>\n";
		$return .= "  <td class=\"fieldCell\">";
		if ($ui == 2 && $testfeature) {
			$return .= "<input class=\"inputbox\" type=\"text\" name=\"".$this->_getPGparamName("cb_pglastupdate")."\" mosReq=\"0\" mosLabel=\"" . htmlspecialchars(CBTxt::T("Last Update")) . "\" value=\"".(isset($user->cb_pglastupdate) ? $user->cb_pglastupdate : null)."\" size=\"10\" />";

		} else {
			$return .= $quota;
		}
		$return .= getFieldIcons($ui, false, false, CBTxt::Th("Date of last update to Gallery items in this profile"), CBTxt::Th("Last Update") . ":");
		$return .= "</td>\n</tr>\n";
		
		// Display Format:
		if ($tabparams["pgallowdisplayformatoverride"] || $ui ==2 || $isModerator) {
			$displayFormat = array();
			$displayFormat[] = moscomprofilerHTML::makeOption( '', ' ' );
			$displayFormat[] = moscomprofilerHTML::makeOption( 'DF1', CBTxt::T("Pictures gallery list format")  );
			$displayFormat[] = moscomprofilerHTML::makeOption( 'DF2', CBTxt::T("File list format") );
			$displayFormat[] = moscomprofilerHTML::makeOption( 'DF3', CBTxt::T("Picture gallery list lightbox format") );
			$lists['_pg_DisplayFormat'] = moscomprofilerHTML::selectList( $displayFormat, $this->_getPGparamName("cb_pgdisplayformat"), 'class="inputbox" size="1" mosReq="0" mosLabel="' . htmlspecialchars(CBTxt::T("Display Format")) . '"', 'value', 'text', $user->cb_pgdisplayformat );
			$return .= "<tr>\n";
			$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Display Format") . ":</td>\n";
			$return .= "  <td class=\"fieldCell\">". $lists['_pg_DisplayFormat'];
			$return .= getFieldIcons($ui, false, false, CBTxt::Th("Select Display Format to apply for gallery viewing."), CBTxt::Th("Display Format") . ":");
			$return .= "</td>\n</tr>\n";
		}
		
		// Access Mode:
		if ($tabparams["pgallowaccessmodeoverride"] || $ui ==2 || $isModerator) {
			$accessMode = array();
			$accessMode[] = moscomprofilerHTML::makeOption( '', ' ' );
			$accessMode[] = moscomprofilerHTML::makeOption( 'PUB', CBTxt::T("Allow Public Access")  );
			$accessMode[] = moscomprofilerHTML::makeOption( 'REG', CBTxt::T("Allow Registered Access") );
			$accessMode[] = moscomprofilerHTML::makeOption( 'CON', CBTxt::T("Allow Connections Access") );
			$accessMode[] = moscomprofilerHTML::makeOption( 'REG-S', CBTxt::T("Registered Stealth Access") );
			$accessMode[] = moscomprofilerHTML::makeOption( 'CON-S', CBTxt::T("Connections Stealth Access") );
			
			$lists['_pg_AccessMode'] = moscomprofilerHTML::selectList( $accessMode, $this->_getPGparamName("cb_pgaccessmode"), 'class="inputbox" size="1" mosReq="0" mosLabel="' . htmlspecialchars(CBTxt::T("Access Mode")) . '"', 'value', 'text', $user->cb_pgaccessmode );
			$return .= "<tr>\n";
			$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Access Mode") . ":</td>\n";
			$return .= "  <td class=\"fieldCell\">". $lists['_pg_AccessMode'];
			$return .= getFieldIcons($ui, false, false, CBTxt::Th("Select desirable access mode: Public access, Registered users only, Connected users only, REG-S for Registered-stealth, CON-S for Connections-stealth"), CBTxt::Th("Access Mode") . ":");
			$return .= "</td>\n</tr>\n";
		}

		//$return .= "<tr>\n";
		//$return .= "  <td class=\"titleCell\">--- end ---</td>\n";
		//$return .= "  <td class=\"fieldCell\">--- end of programmed fields ! below are the standard cb fields: change fields to 0</td>\n";
		//$return .= "</tr>\n";
		$return .= "</table>\n";

		return $return;
	}
Ejemplo n.º 4
0
	function editPluginSettingsParams( &$row, $option, $task, $uid, &$element, &$params, &$options ) {
		global $_CB_database, $_CB_framework;
	
		$lists 	= array();
	
		// get list of groups
		if ($row->access == 99 || $row->client_id == 1) {
			$lists['access'] = CBTxt::T('Administrator') . '<input type="hidden" name="access" value="99" />';
		} else {
			// build the html select list for the group access
			$accessTree		=	$_CB_framework->acl->get_access_children_tree();
			$lists['access'] = moscomprofilerHTML::selectList( $accessTree, 'access', 'class="inputbox" size="3"', 'value', 'text', intval( $row->access ), 2 );
		}
	
		if ($uid) {
			$row->checkout( $_CB_framework->myId() );
	
			if ( $row->ordering > -10000 && $row->ordering < 10000 ) {
				// build the html select list for ordering
				$query = "SELECT ordering AS value, name AS text"
				. "\n FROM #__comprofiler_plugin"
				. "\n WHERE type='" . $_CB_database->getEscaped( $row->type ) . "'"
				. "\n AND published > 0"
				. "\n AND ordering > -10000"
				. "\n AND ordering < 10000"
				. "\n ORDER BY ordering"
				;
				$order = $this->_cbGetOrderingList( $query );
				$lists['ordering'] = moscomprofilerHTML::selectList( $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval( $row->ordering ), 2 );
			} else {
				$lists['ordering'] = '<input type="hidden" name="ordering" value="'. $row->ordering .'" />' . CBTxt::T('This plugin cannot be reordered');
			}
			$lists['type'] = '<input type="hidden" name="type" value="'. $row->type .'" />'. $row->type;
	
			if ($element && $element->name() == 'cbinstall' && $element->attributes( 'type' ) == 'plugin' ) {
				$description =& $element->getElementByPath( 'description' );
				$row->description = ( $description ) ? trim( $description->data() ) : '';
			}
	
		} else {
			$row->folder 		= '';
			$row->ordering 		= 999;
			$row->published 	= 1;
			$row->description 	= '';
	
			$folders			= cbReadDirectory( $_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/' );
			$folders2			= array();
			foreach ($folders as $folder) {
			    if (is_dir( $_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/' . $folder ) && ( $folder <> 'CVS' ) ) {
			        $folders2[] = moscomprofilerHTML::makeOption( $folder );
				}
			}
			$lists['type']		= moscomprofilerHTML::selectList( $folders2, 'type', 'class="inputbox" size="1"', 'value', 'text', null, 2 );
			$lists['ordering']	= '<input type="hidden" name="ordering" value="'. $row->ordering .'" />' . CBTxt::T('New items default to the last place. Ordering can be changed after this item is saved.') ;
		}
	
		$Yesoptions = array();
		$Yesoptions[] = moscomprofilerHTML::makeOption( '1', _UE_YES );
		if ( ( $row->type == 'language' ) || ( $row->id == 1 ) ) {
			$row->published		=	1;
		} else {
			$Yesoptions[]		=	moscomprofilerHTML::makeOption( '0', _UE_NO );
		}
		$lists['published'] = moscomprofilerHTML::radioList( $Yesoptions, 'published', 'class="inputbox"', 'value', 'text', $row->published, 2 );
	
		$pluginView				=	_CBloadView( 'plugin' );
		$pluginView->editPlugin( $row, $lists, $params, $options );
	}
	/**
	 * Draws the Credit-card selector (radios)
	 *
	 * @param  string[]     $cardTypes    Card-types available
	 * @param  string|null  $chosenCard   Chosen card if any
	 * @return string                     HTML
	 */
	private function _renderCCSelector( $cardTypes, $chosenCard = null ) {
		$card_choice_type = $this->getAccountParam( 'card_choice_type', 'image' );

		$choices = array();
		if ( $card_choice_type == 'text' ) {
			foreach ( $cardTypes as $cType ) {
				$choices[] = moscomprofilerHTML::makeOption( $cType, ucwords( $cType ) );
			}
		} else {
			foreach ( $cardTypes as $cType ) {
				$cardImg = $this->_renderCCimg( $cType );
				$choices[] = moscomprofilerHTML::makeOption( $cType, $cardImg );
			}
		}
		$ret = moscomprofilerHTML::radioList( $choices, $this->_getPagingParamName( 'cardtype' ), '', 'value', 'text', $chosenCard );
		return $ret;
	}