Inheritance: extends Controller
Example #1
0
"></link>
		<link rel="stylesheet" type="text/css" href="<?php 
_p(__VIRTUAL_DIRECTORY__ . __EXAMPLES__ . '/includes/examples.css');
?>
"></link>
	</head>
	<body>
		<div id="page">
			<div id="header">
				<div id="headerLeft">
					<div id="pageName"><?php 
_p(Examples::PageName($strReference));
?>
 - View Source</div>
					<div id="pageLinks"><span class="headerSmall"><?php 
_p(Examples::CodeLinks($strReference, $strScript), false);
?>
</span></div>
				</div>
				<div id="headerRight">
					<div id="closeWindow"><a href="javascript:window.close()">Close Window</a></div>
				</div>
			<div>
			<div id="content">
<?php 
// Filename Cleanup
if ($strScript == 'header.inc.php' || $strScript == 'footer.inc.php' || $strScript == 'examples.css') {
    $strFilename = 'includes/' . $strScript;
} else {
    if ($strScript == 'mysql_innodb.sql' || $strScript == 'sql_server.sql') {
        $strFilename = $strScript;
 public static function PageLinks()
 {
     $strPrevious = null;
     $strNext = null;
     $blnFound = false;
     $strScript = QApplication::$ScriptName;
     if (strpos($strScript, "plugin") !== false && strpos($strScript, "vendor") !== false) {
         // a plugin
         $strLink = QHtml::RenderLink(QHtml::MakeUrl(__DEVTOOLS_ASSETS__ . '/plugin_manager.php'), "Plugin Manager", ["class" => "headerLink"]);
         return $strLink;
     }
     foreach (Examples::$Categories as $objExampleCategory) {
         if (!$blnFound) {
             $strPrevious = null;
             $strNext = null;
             foreach ($objExampleCategory as $strKey => $strExample) {
                 if (is_numeric($strKey)) {
                     // Pull out the URL fragment from the example tree
                     $intPosition = strpos($strExample, ' ');
                     $strScriptName = substr($strExample, 0, $intPosition);
                     $strDescription = substr($strExample, $intPosition + 1);
                     $qapp = QApplication::$ScriptName;
                     if (!$blnFound) {
                         if (strpos(QApplication::$ScriptName, $strScriptName) !== false || strpos($strScriptName, QApplication::$ScriptName) !== false) {
                             // for plugins examples
                             $blnFound = true;
                         } else {
                             $strPrevious = sprintf('<strong><a href="%s" class="headerLink">&lt;&lt; %s</a></strong>', $strScriptName, $strDescription);
                         }
                     } else {
                         if (!$strNext) {
                             $strNext = sprintf('<strong><a href="%s" class="headerLink">%s &gt;&gt;</a></strong>', $strScriptName, $strDescription);
                         }
                     }
                 }
             }
         }
     }
     $strToReturn = '';
     if ($strPrevious) {
         $strToReturn = $strPrevious;
     } else {
         $strToReturn = '<span class="headerGray">&lt;&lt; Previous</span>';
     }
     $intCategoryId = Examples::GetCategoryId();
     if ($intCategoryId < 3) {
         $intPartId = 1;
     } else {
         if ($intCategoryId < 10) {
             $intPartId = 2;
         } else {
             $intPartId = 3;
         }
     }
     $strToReturn .= ' &nbsp; | &nbsp; ';
     $strToReturn .= sprintf('<strong><a href="%s/index.php%s" class="headerLink">Back to Main</a></strong>', __VIRTUAL_DIRECTORY__ . __EXAMPLES__, $intPartId == 1 ? "" : "/" . $intPartId);
     $strToReturn .= ' &nbsp; | &nbsp; ';
     if ($strNext) {
         $strToReturn .= $strNext;
     } else {
         $strToReturn .= '<span class="headerGray">Next &gt;&gt;</span>';
     }
     return $strToReturn;
 }
<?php

// The url to send to view_source.php
// first encode the basic info
$strCatId = Examples::GetCategoryId();
$strUrl = __VIRTUAL_DIRECTORY__ . __EXAMPLES__ . '/view_source.php/' . $strCatId . '/' . Examples::GetExampleId();
if ($strCatId == "plugin") {
    $strFile = Examples::GetPluginFile();
    $strUrl .= '/' . $strFile . '/' . $strFile;
} else {
    $strUrl .= '/' . basename(QApplication::$ScriptName);
}
if (!isset($mainPage)) {
    ?>
			<button id="viewSource">View Source</button>
<?php 
}
?>
		</section>
		<footer>
			<div id="tagline"><a href="http://qcubed.github.com/" title="QCubed Homepage"><img id="logo" src="<?php 
_p(__VIRTUAL_DIRECTORY__ . __IMAGE_ASSETS__ . '/qcubed_logo_footer.png', false);
?>
" alt="QCubed Framework" /> <span class="version"><?php 
_p(QCUBED_VERSION);
?>
</span></a></div>
		</footer>
		
		<script type="text/javascript">
			// jQuery isn't always available
Example #4
0
		while installing, as well as uninstalling your plugin.<br /><br />
		
		Then, create a few folders under the root, and place the files that you
		want to be distributed with the plugin there - the structure is entirely
		up to you. You may want to put all your included PHP files under the includes
		directory, or you may not; you can put all images in a separate folder, or
		just keep them as siblings of the configuration file. <br /><br />
		
		A plugin is described through a <b>QPlugin</b> object - you can see all the
		properties of that object by inspecting the
		<b><?php 
echo substr(__QCUBED_CORE__, strlen(__DOCROOT__));
?>
/framework/QPluginInterface.class.php</b>
		file. <a href="javascript:ViewSource(<?php 
_p(Examples::GetCategoryId() . ',' . Examples::GetExampleId() . ',"__CORE_FRAMEWORK__QPluginInterface.class.php"');
?>
);">Take a look </a>at it now.<br /><br />
		
		To define the QPlugin object, we'll first set simple metadata on it:
		
		<div style="padding-left: 50px;">
			<code>
				$objPlugin = new QPlugin();<br />
				$objPlugin->strName = "MyCoolPlugin"; // no spaces allowed<br />
				$objPlugin->strDescription = 'A great little plugin that does this and that';<br />
				$objPlugin->strVersion = "0.1";<br />
				$objPlugin->strPlatformVersion = "1.1"; // version of QCubed that this plugin works well with<br />
				$objPlugin->strAuthorName = "Alex Weinstein, a.k.a. alex94040";<br />
				$objPlugin->strAuthorEmail ="alex94040 [at] yahoo [dot] com";				
			</code>
Example #5
0
		<header>
			<div class="breadcrumb">
<?php 
if (!isset($mainPage)) {
    ?>
				<span class="category-name"><?php 
    _p(Examples::GetCategoryId() + 1 . '. ' . Examples::$Categories[Examples::GetCategoryId()]['name'], false);
    ?>
</span> / 
<?php 
}
?>
				<strong class="page-name"><?php 
_p(Examples::PageName(), false);
?>
</strong>
			</div>
			
<?php 
if (!isset($mainPage)) {
    ?>
			<nav class="page-links"><?php 
    _p(Examples::PageLinks(), false);
    ?>
</nav>
<?php 
}
?>
			
		</header>
		<section id="content">
Example #6
0
 public static function PageLinks()
 {
     $strPrevious = null;
     $strNext = null;
     $blnFound = false;
     foreach (Examples::$Categories as $objExampleCategory) {
         if (!$blnFound) {
             $strPrevious = null;
             $strNext = null;
             foreach ($objExampleCategory as $strKey => $strExample) {
                 if (is_numeric($strKey)) {
                     // Pull out the URL fragment from the example tree
                     $intPosition = strpos($strExample, ' ');
                     $strScriptName = substr($strExample, 0, $intPosition);
                     $strDescription = substr($strExample, $intPosition + 1);
                     if (!$blnFound) {
                         if (strpos(QApplication::$ScriptName, $strScriptName) !== false) {
                             $blnFound = true;
                         } else {
                             $strPrevious = sprintf('<b><a href="%s/examples%s" class="headingLink">&lt;&lt; %s</a></b>', __VIRTUAL_DIRECTORY__, $strScriptName, $strDescription);
                         }
                     } else {
                         if (!$strNext) {
                             $strNext = sprintf('<b><a href="%s/examples%s" class="headingLink">%s &gt;&gt;</a></b>', __VIRTUAL_DIRECTORY__, $strScriptName, $strDescription);
                         }
                     }
                 }
             }
         }
     }
     $strToReturn = '';
     if ($strPrevious) {
         $strToReturn = $strPrevious;
     } else {
         $strToReturn = '<span class="headingLeftGray">&lt;&lt; Previous</span>';
     }
     $intCategoryId = Examples::GetCategoryId();
     if ($intCategoryId < 3) {
         $intPartId = 1;
     } else {
         if ($intCategoryId < 10) {
             $intPartId = 2;
         } else {
             $intPartId = 3;
         }
     }
     $strToReturn .= ' &nbsp; | &nbsp; ';
     $strToReturn .= sprintf('<b><a href="%s/examples/index.php/%s" class="headingLink">Back to Main</a></b>', __VIRTUAL_DIRECTORY__, $intPartId);
     $strToReturn .= ' &nbsp; | &nbsp; ';
     if ($strNext) {
         $strToReturn .= $strNext;
     } else {
         $strToReturn .= '<span class="headingLeftGray">Next &gt;&gt;</span>';
     }
     return $strToReturn;
 }
Example #7
0
				<?php 
_p(Examples::GetCategoryId() + 1 . '. ' . Examples::$Categories[Examples::GetCategoryId()]['name'], false);
?>
<br/>
			</span>
				<?php 
_p(Examples::PageName(), false);
?>
<br/>
			<span class="headingLeftSmall">
				<?php 
_p(Examples::PageLinks(), false);
?>
			</span>
			</td>
			<td class="headingRight"><br/>
				<b><a href="javascript:ViewSource(<?php 
_p(Examples::GetCategoryId() . ',' . Examples::GetExampleId());
?>
);" class="headingLink">View Source</a></b>
<!--				<a href="#" onclick="window.open('http://localhost/validator/htdocs/check?uri=<?php 
_p(urlencode('http://qcodo/' . QApplication::$RequestUri));
?>
'); return false;" style="color: #ffffff;">Validate</a>-->
				<br/>
				<span class="headingLeftSmall">will open in a new window</span>
			</td>
		</tr>
	</table>
	
	<div class="page">
Example #8
0
		
		<script type="text/javascript">
			// jQuery isn't always available
			var viewSource = document.getElementById('viewSource');
			if (viewSource) {
				viewSource.onclick = function (){
					var fileNameSection = "",
						objWindow;
					if (arguments.length == 3) {
						fileNameSection = "/" + strFilename;
					}
					objWindow = window.open("<?php 
echo __VIRTUAL_DIRECTORY__ . __EXAMPLES__;
?>
/view_source.php/<?php 
_p(Examples::GetCategoryId() . "/" . Examples::GetExampleId());
?>
" + fileNameSection, "ViewSource", "menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=1000,height=750,left=50,top=50");
					objWindow.focus();
					return false;
				};
			}			
			window.gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
			document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

			try {
				window.pageTracker = _gat._getTracker("UA-7231795-1");
				pageTracker._trackPageview();
			} catch(err) {}
		</script>
	</body>
		<link rel="stylesheet" type="text/css" href="<?php _p(__VIRTUAL_DIRECTORY__ . __CSS_ASSETS__ . '/styles.css'); ?>"></link>
		<link rel="stylesheet" type="text/css" href="<?php _p(__VIRTUAL_DIRECTORY__ . __EXAMPLES__ . '/includes/examples.css'); ?>"></link>
		<script type="text/javascript">
			function ViewSource(intCategoryId, intExampleId) {
				var objWindow = window.open("../view_source.php/" + intCategoryId + "/" + intExampleId, "ViewSource", "menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=1000,height=750,left=50,top=50");
				objWindow.focus();
			}
		</script>
	</head>
	<body> 

	<table border="0" cellspacing="0" width="100%">
		<tr>
			<td class="headingLeft"><span class="headingLeftSmall">
				<?php _p((Examples::GetCategoryId() + 1) . '. ' . Examples::$Categories[Examples::GetCategoryId()]['name'], false); ?><br/>
			</span>
				<?php _p(Examples::PageName(), false); ?><br/>
			<span class="headingLeftSmall">
				<?php _p(Examples::PageLinks(), false); ?>
			</span>
			</td>
			<td class="headingRight"><br/>
				<b><a href="javascript:ViewSource(<?php _p(Examples::GetCategoryId() . ',' . Examples::GetExampleId()); ?>);" class="headingLink">View Source</a></b>
<!--				<a href="#" onclick="window.open('http://localhost/validator/htdocs/check?uri=<?php _p(urlencode('http://qcodo/' . QApplication::$RequestUri)); ?>'); return false;" style="color: #ffffff;">Validate</a>-->
				<br/>
				<span class="headingLeftSmall">will open in a new window</span>
			</td>
		</tr>
	</table>
	
	<div class="page">
Example #10
0
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=<?php 
_p(QApplication::$EncodingType);
?>
" />
		<title>Qcodo Development Framework - Examples</title>
		<link rel="stylesheet" type="text/css" href="<?php 
_p(__VIRTUAL_DIRECTORY__ . __EXAMPLES__ . '/includes/examples.css');
?>
"></link>
	</head>
	<body> 

	<table border="0" cellspacing="0" width="100%">
		<tr>
			<td class="headingLeft"><span class="headingLeftSmall">Qcodo Examples - <?php 
_p(QCODO_VERSION);
?>
<br/></span>
				<?php 
_p(Examples::PageName(), false);
?>
<br/>
			<span class="headingLeftSmall"></span>
			</td>
			<td class="headingRight"></td>
		</tr>
	</table>
	
	<div class="page">
<?php require('includes/examples.inc.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=<?php _p(QApplication::$EncodingType); ?>" />
		<title>Qcodo Development Framework - Examples | Staff Console</title>
		<link rel="stylesheet" type="text/css" href="<?php _p(__VIRTUAL_DIRECTORY__ . __EXAMPLES__ . '/includes/examples.css'); ?>"></link>
	</head>
	<body> 

	<table border="0" cellspacing="0" width="100%">
		<tr>
			<td class="headingLeft"><span class="headingLeftSmall">Qcodo Examples - <?php _p(QCODO_VERSION); ?><br/></span>
				<?php _p(Examples::PageName(), false); ?><br/>
			<span class="headingLeftSmall"></span>
			</td>
			<td class="headingRight"></td>
		</tr>
	</table>
	
	<div class="page">
?>
" />
		<title>QCubed PHP 5 Development Framework - View Source</title>
		<link rel="stylesheet" type="text/css" href="<?php 
_p(__VIRTUAL_DIRECTORY__ . __CSS_ASSETS__ . '/styles.css');
?>
" />
		<link rel="stylesheet" type="text/css" href="<?php 
_p(__VIRTUAL_DIRECTORY__ . __EXAMPLES__ . '/includes/examples.css');
?>
" />
	</head>
	<body>
		<div id="closeWindow"><a href="javascript:window.close()" class="close-window">Close this Window</a></div>
		<header><nav class="page-links"><span class="headerSmall"><?php 
_p(Examples::CodeLinks($strCategoryId, $strExampleId, $strSubId, $strScript), false);
?>
</nav></header>
		<section id="content">
<?php 
// Filename Cleanup
if ($strScript == 'header.inc.php' || $strScript == 'footer.inc.php' || $strScript == 'examples.css') {
    $strFilename = 'includes/' . $strScript;
} else {
    if ($strScript == 'mysql_innodb.sql' || $strScript == 'sql_server.sql') {
        $strFilename = $strScript;
    } else {
        if (substr($strScript, 0, 16) == '__CORE_CONTROL__') {
            $strFilename = __QCUBED__ . '/controls/' . str_replace('__CORE_CONTROL__', '', str_replace('/', '', $strScript));
        } else {
            if (substr($strScript, 0, 18) == '__CORE_FRAMEWORK__') {
Example #13
0
function examplesMenu()
{
    Yii::import("application.modules.stores.models.Stores", true);
    Yii::import("application.modules.examples.models.Examples", true);
    $store_limit = Yii::app()->params['store_example_limit'];
    $example_limit = Yii::app()->params['before_after_limit'];
    $stores_examples = Stores::model()->findAll(array('limit' => "{$store_limit}", 'order' => "sequence", "condition" => "publish = 1 AND store_type='example' AND deleted = 0 "));
    $examples = Examples::model()->findAll(array("condition" => "publish = 1 AND status = 1 AND deleted = 0 LIMIT {$example_limit}"));
    return array('stores' => $stores_examples, 'examples' => $examples);
}