Exemple #1
0
 function display($tpl = null)
 {
     $this->installed_version = JvrelInstallerHelper::getVersionFromManifest();
     $this->news_feed = $this->get('LatestNews');
     $this->addToolBar();
     $this->sidebar = JHtmlSidebar::render();
     $this->setDocument();
     parent::display($tpl);
 }
Exemple #2
0
    public static function showFooter()
    {
        $val = '<p>&nbsp;</p>
    			<div class="well well-small">
					<strong>JV-Relatives ' . JvrelInstallerHelper::getDbVersion() . '</strong><br />
					Copyright 2008-2015. Niranjan SrinivasaRao / JV-Extensions.com<br />
					<strong>If you like JV-Relatives, please post a rating and a review at the <a href="http://extensions.joomla.org/extensions/news-display/articles-display/related-items/4500" target="_blank">Joomla! Extensions Directory</a>.</strong>
				</div>';
        echo $val;
    }
Exemple #3
0
 private function installJvrelatives()
 {
     $out = '';
     $ma_version = JvrelInstallerHelper::getVersionFromManifest();
     $db_version = JvrelInstallerHelper::getDbVersion();
     try {
         if (0 == $db_version) {
             $installer = JvrelInstallerHelper::getInstallerObject("0.0");
             $installer->execute();
             if ($installer->getErrorFlag()) {
                 throw new Exception($installer->getMessage());
             }
             JvrelInstallerHelper::updateVersionInDb($ma_version);
             $out .= '0|0|100|' . $installer->getMessage();
         } else {
             $sindex = $tindex = 0;
             $versions_to_upgrade = JvrelInstallerHelper::getVersionsUpgradeList($db_version, $sindex, $tindex);
             if (0 == count($versions_to_upgrade)) {
                 $out .= '0|0|100|Upgrade complete';
             } else {
                 $installer = JvrelInstallerHelper::getInstallerObject($versions_to_upgrade[0]);
                 $retval = $installer->execute();
                 if ($installer->getErrorFlag()) {
                     throw new Exception($installer->getMessage());
                 }
                 if ($retval == -99 || $retval == -1) {
                     JvrelInstallerHelper::updateVersionInDb($versions_to_upgrade[0]);
                     if (1 == count($versions_to_upgrade)) {
                         $out .= '0|0|100|' . $installer->getMessage();
                     } else {
                         $percent_complete = intval((1 + $sindex) * 100 / (1 + $tindex + 1));
                         $percent_complete = $percent_complete > 100 ? 100 : $percent_complete;
                         $out .= $versions_to_upgrade[1] . '|0|' . $percent_complete . '|' . $installer->getMessage();
                     }
                 } else {
                     $percent_complete = intval((1 + $sindex) * 100 / (1 + $tindex + 1));
                     $percent_complete = $percent_complete > 100 ? 100 : $percent_complete;
                     $out .= $versions_to_upgrade[0] . '|0|' . $percent_complete . '|' . $installer->getMessage();
                 }
             }
         }
     } catch (Exception $ex) {
         $out .= '0|1|100|<p class="alert alert-error">' . $ex->getMessage() . '</p>';
     }
     $out = JString::trim($out, "<br />");
     $out .= "<br />";
     echo $out;
     // {next_version_to_upgrade|error flag|percent complete|message}
 }
 function __construct($version, $sqls = array())
 {
     $this->sl = 0;
     $this->sl_start = 0;
     $this->sl_maxrec = 500;
     $this->sl_total = 0;
     $this->sl_allcnt = 0;
     $this->error = 0;
     $this->version = $version;
     $this->sqls = $sqls;
     $this->dversion = $this->version == "0.0" ? JvrelInstallerHelper::getVersionFromManifest() : $this->version;
     $this->add2DebugLog("Installing Component Version: " . $this->dversion, 2);
 }
Exemple #5
0
    function display($tpl = null)
    {
        JHtml::_('jquery.framework');
        $title = "";
        $versions_to_upgrade = array();
        try {
            $ma_version = JvrelInstallerHelper::getVersionFromManifest();
            $db_version = JvrelInstallerHelper::getDbVersion();
            if (0 == $db_version) {
                $title = $this->compname . " Component - New Installation";
                $desc = "Welcome to New Installation of " . $this->compname . " Component. This utility will install " . $this->compname . " component version " . $ma_version . " on your Joomla website. Please click on the 'Install/Upgrade' button to start the installation";
            } else {
                $sindex = $tindex = 0;
                $versions_to_upgrade = JvrelInstallerHelper::getVersionsUpgradeList($db_version, $sindex, $tindex);
                $title = $this->compname . " - Upgrade";
                $desc = "Welcome to Upgrade Installation of " . $this->compname . " Component. This utility will upgrade the " . $this->compname . " component to version " . $ma_version . " on your Joomla website. Please click on the 'Install/Upgrade' button to start the upgrade";
            }
            $ajaxQuery = '	jQuery(document).ready(function() {
								var url = "index.php?option=' . $this->compcode . '";
								jQuery("#install").click(function(event) {
									event.preventDefault();	
									jQuery("#install").prop("disabled", true);
										
									var ajaxPost = jQuery.post(url, {
										view : "ajax",
										format : "raw",
										layout : "install"
									});
									ajaxPost.done(function(data) {
										var parsed = data.split("|");
										var nstep = parsed[0];
										var errflag = parsed[1];
										var percent = parsed[2];
            							var msg = parsed[3];
										
										jQuery("#iarea").append("<br />"+msg+"<br /><br />");
										jQuery("#pbar").css("width", percent+"%");
										
										if (nstep == "0") {
											if (errflag == "0") {
												jQuery("#pbar").addClass("bar-success");
												jQuery("#dashboard").css("display", "inline");																				
												jQuery("#iarea").append("<div class=\\"alert alert-success\\">All installation/upgrade steps have been completed successfully</div>");										
											}
											else {
												jQuery("#pbar").addClass("bar-danger");
												jQuery("#iarea").append("<div class=\\"alert alert-error\\">Error encountered during installation/upgrade. Please contact support@jv-extensions.com</div>");
											}
										}
										else {
											jQuery("tr").removeClass("success");
											jQuery("#"+nstep).addClass("success");
										
											timer = setTimeout(function() {
												jQuery("#install").trigger("click");
            								}, 2000);  											
										}
									})				
									ajaxPost.fail(function() {
										jQuery("#pbar").css("width", "100%");
										jQuery("#pbar").addClass("bar-danger");
										jQuery("#iarea").append("<div class=\\"alert alert-error\\">Error encountered during installation/upgrade</div>");										
									})
									ajaxPost.always(function() {
									});						
								});	
							});
						';
            $document = JFactory::getDocument();
            $document->addScriptDeclaration($ajaxQuery);
            $this->desc = $desc;
        } catch (Exception $ex) {
            $title = $this->compname . " Installation";
            $this->desc = $ex->getMessage();
        }
        $this->versions_to_upgrade = $versions_to_upgrade;
        JToolBarHelper::title($title, 'generic.png');
        parent::display($tpl);
    }