getTemplateId() public method

public getTemplateId ( ) : integer
return integer
/**
 * Campsite interview_form block plugin
 *
 * Type:     block
 * Name:     interview_form
 * Purpose:  Provides a form for an interview
 *
 * @param string
 *     $p_params
 * @param string
 *     $p_smarty
 * @param string
 *     $p_content
 *
 * @return
 *
 */
function smarty_block_interview_form($p_params, $p_content, &$p_smarty, &$p_repeat)
{
    require_once $p_smarty->_get_plugin_filepath('shared','escape_special_chars');
    
    // gets the context variable
    $campsite = $p_smarty->get_template_vars('gimme');
    $html = '';
    
    if (0) {
        $Interview = new Interview($campsite->interview->identifier);
        return $Interview->getForm('/en/first/interview/', '', true);
    }
    
    if (isset($p_params['template'])) {
        $template = new Template($p_params['template']);
        $tpl_id = $template->getTemplateId();
    }
    if (!isset($p_params['submit_button'])) {
        $p_params['submit_button'] = 'Submit';
    }
    if (!isset($p_params['html_code']) || empty($p_params['html_code'])) {
        $p_params['html_code'] = '';
    }

    if (isset($p_content)) {
        $html = "<form name=\"interview\" action=\"{$campsite->url->uri_path}\" method=\"post\" enctype=\"multipart/form-data\">\n";
        $html .= "<input type=\"hidden\" name=\"_qf__interview\">\n";
        $html .= "<input type=\"hidden\" name=\"f_interview\" value=\"edit\">\n";
        
        if ($tpl_id) {
            $html .= "<input type=\"hidden\" name=\"".TEMPLATE_ID."\" value=\"$tpl_id\" />\n";
        }
        if ($campsite->interview->identifier) {
            $html .= "<input type=\"hidden\" name=\"f_interview_id\" value=\"{$campsite->interview->identifier}\" />\n";
        }
        $html .= $p_content;
        $html .= "<input type=\"submit\" name=\"f_interview_submit\" value=\""
              .smarty_function_escape_special_chars($p_params['submit_button'])
              ."\" ".$p_params['html_code']." />\n</form>\n";
    }

    return $html;
} // fn smarty_block_poll_form
Example #2
0
if (!file_exists($filename)) {
    camp_html_display_error(getGS("Invalid template file $1" , $f_path."/$f_name"), $backLink);
    exit;
}

if (!is_writable($filename)) {
    camp_html_add_msg(camp_get_error_message(CAMP_ERROR_WRITE_FILE, $filename));
}

$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
$imageExtensions = array("png", "jpg", "jpeg", "jpe", "gif");

$templateDisplayName = $f_name;
if ($templateObj->exists()) {
    $templateDisplayName .= ' ('.getGS("Template ID:").' '.$templateObj->getTemplateId().')';
}

$f_lifetime = (int)$templateObj->getCacheLifetime();

$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Templates"), "/$ADMIN/templates/");
$crumbs = array_merge($crumbs, camp_template_path_crumbs($f_path));
$crumbs[] = array(getGS("Edit template").": $templateDisplayName", "");
echo camp_html_breadcrumbs($crumbs);

include_once($GLOBALS['g_campsiteDir']."/$ADMIN_DIR/javascript_common.php");

camp_html_display_msgs();
Example #3
0
 $templateObj = new Template($templateName);
 if ($color) {
     $tr_class = "list_row_even";
 } else {
     $tr_class = "list_row_odd";
 }
 $color = !$color;
 print "\n\t\t<script>default_class[" . $counter ."] = \"" . $tr_class . "\";</script>";
 if (camp_is_text_file($filename)) {
     if (empty($listbasedir) && ($filename == "home.tpl")) {
         print "\n\t\t<TR id=\"row_" . $counter . "\" style=\"background-color:#7dcd82;\" onmouseover=\"setPointer(this, " . $counter . ", 'over');\" onmouseout=\"setPointer(this, " . $counter . ", 'out');\" >";
     } else {
         print "\n\t\t<TR id=\"row_" . $counter . "\" class=\"" . $tr_class . "\" onmouseover=\"setPointer(this, " . $counter . ", 'over');\" onmouseout=\"setPointer(this, " . $counter . ", 'out');\">";
     }
     print "\n\t\t\t<TD><INPUT TYPE=\"checkbox\" VALUE=\"";
     if ($templateObj->exists()) { p($templateObj->getTemplateId()); } else { putGS("N/A"); }
     print "\" NAME=\"f_template_code[]\" ID=\"checkbox_" . $counter . "\" CLASS=\"input_checkbox\" onclick=\"checkboxClick(this, " . $counter . ");\" /></TD>";
     print "\n\t\t\t<TD valign=\"center\"><IMG SRC='".$Campsite["ADMIN_IMAGE_BASE_URL"]."/generic.gif' BORDER='0'>&nbsp;<A HREF='/$ADMIN/templates/edit_template.php?f_path=" .urlencode($listbasedir)."&f_name=".urlencode($filename)."'>$filename</A></TD>";
 } elseif (camp_is_image_file($filename)) {
     print "\n\t\t<TR id=\"row_" . $counter . "\" class=\"" . $tr_class . "\">";
     print "\n\t\t\t<TD><INPUT TYPE=\"checkbox\" VALUE=\"";
     if ($templateObj->exists()) { p($templateObj->getTemplateId()); } else { putGS("N/A"); }
     print "\" NAME=\"f_template_code[]\" ID=\"checkbox_" . $counter . "\" CLASS=\"input_checkbox\" /></TD>";
     print "\n\t\t\t<TD><IMG SRC='".$Campsite["ADMIN_IMAGE_BASE_URL"]."/image.png' BORDER='0'> <A HREF='/$ADMIN/templates/edit_template.php?f_path=" .urlencode($listbasedir)."&f_name=".urlencode($filename)."'>$filename</a></TD>";
 } else {
     print "\n\t\t<TR $tr_class>";
     print "\n\t\t\t<TD><INPUT TYPE=\"checkbox\" VALUE=\"";
     if ($templateObj->exists()) { p($templateObj->getTemplateId()); } else { putGS("N/A"); }
     print "\" NAME=\"f_template_code[]\" ID=\"checkbox_" . $counter . "\" CLASS=\"input_checkbox\" onclick=\"checkboxClick(this, " . $counter . ");\" /></TD>";
     print "\n\t\t\t<TD><IMG SRC='".$Campsite["ADMIN_IMAGE_BASE_URL"]."/generic.gif' BORDER='0'> $filename</TD>";
 }
    /**
     * Sets the URI path and query values based on given parameters.
     *
     * @param array $p_params
     *      An array of valid URL parameters
     * @param boolean $p_preview
     *      If true, will keep the preview parameters in the URL
     *
     * @return void
     */
    protected function buildURI(array &$p_params = array(), $p_preview = false)
    {
        if ($this->isValidCache()) {
            return;
        }

        $parameter = count($p_params) > 0 ? strtolower(array_shift($p_params)) : null;

        switch($parameter) {
            case 'language':
            case 'publication':
                $this->m_buildPath = $this->getURILanguage();
                if ($p_preview) {
                    $this->m_buildQueryArray = $this->getQueryArray(CampURI::$m_previewParameters);
                } else {
                	$this->m_buildQueryArray = array();
                }
                $p_params = array();
                break;
            case 'issue':
                $this->m_buildPath = $this->getURIIssue();
                if ($p_preview) {
                    $this->m_buildQueryArray = $this->getQueryArray(CampURI::$m_previewParameters);
                } else {
                    $this->m_buildQueryArray = array();
                }
                $p_params = array();
                break;
            case 'section':
                $this->m_buildPath = $this->getURISection();
                if ($p_preview) {
                    $this->m_buildQueryArray = $this->getQueryArray(CampURI::$m_previewParameters);
                } else {
                    $this->m_buildQueryArray = array();
                }
                $p_params = array();
                break;
            case 'article':
                $this->m_buildPath = $this->getURIArticle();
                if ($p_preview) {
                    $this->m_buildQueryArray = $this->getQueryArray(CampURI::$m_previewParameters);
                } else {
                    $this->m_buildQueryArray = array();
                }
                $p_params = array();
                break;
            case 'template':
                $option = isset($p_params[0]) ? array_shift($p_params) : null;
                $template = new Template($option);
                if (!is_null($option) && $template->exists()) {
                    $this->m_buildQueryArray[CampRequest::TEMPLATE_ID] = $template->getTemplateId();
                }
                break;
            default:
                if (!empty($parameter)) {
                    array_unshift($p_params, $parameter);
                    $count = count($p_params);
                    parent::buildURI($p_params, $p_preview);
                    if (count($p_params) == $count) {
                        array_shift($p_params);
                    }
                }
        }

        if (count($p_params) > 0) {
            $this->buildURI($p_params);
        }

        if (!is_null($this->m_language) && $this->m_language->defined() && is_null($this->m_buildPath)) {
            $this->m_buildPath = $this->m_config->getSetting('SUBDIR') . '/' . $this->m_language->code . '/';
            if (!is_null($this->m_issue) && $this->m_issue->defined()) {
                $this->m_buildPath .= $this->m_issue->url_name . '/';
                if (!is_null($this->m_section) && $this->m_section->defined()) {
                    $this->m_buildPath .= $this->m_section->url_name . '/';
                    if (!is_null($this->m_article) && $this->m_article->defined()) {
                        $this->m_buildPath = $this->getURIArticle();
                    }
                }
            }
        }

        if (is_null($this->m_buildQuery)) {
            $this->m_buildQuery = CampURI::QueryArrayToString($this->m_buildQueryArray);
        }

        $this->validateCache(true);
    } // fn buildURI
Example #5
0
	public static function GetURI($p_publicationId, $p_languageId,
	                              $p_issueNo = null, $p_sectionNo = null,
	                              $p_articleNo = null, $p_templateIdOrName = null)
	{
		$languageObj = new Language($p_languageId);
		if (!$languageObj->exists()) {
			return new PEAR_Error(getGS('Language does not exist.'));
		}
		$uri = $GLOBALS['Campsite']['SUBDIR'] . '/' . $languageObj->getCode() . '/';
		if (!is_null($p_issueNo) && is_null($p_articleNo)) {
			$issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo);
			if (!$issueObj->exists()) {
				return new PEAR_Error(getGS('Issue does not exist.'));
			}
			$uri .= $issueObj->getUrlName() . '/';
		}
		if (!is_null($p_sectionNo) && is_null($p_articleNo)) {
			$sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo);
			if (!$sectionObj->exists()) {
				return new PEAR_Error(getGS('Section does not exist.'));
			}
			$uri .= $sectionObj->getUrlName() . '/';
		}
		if (!is_null($p_articleNo)) {
			$articleObj = new Article($p_languageId, $p_articleNo);
			if (!$articleObj->exists()) {
				return new PEAR_Error(getGS('Article does not exist.'));
			}
			$issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber());
			$sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId,
			$articleObj->getSectionNumber());
			$uri .= $issueObj->getUrlName() . '/';
			$uri .= $sectionObj->getUrlName() . '/';
			$uri .= $articleObj->getUrlName() . '/';
		}
		if (!is_null($p_templateIdOrName)) {
			$templateObj = new Template($p_templateIdOrName);
			if (!$templateObj->exists()) {
				return new PEAR_Error(getGS('Template $1 no longer exists!'), $p_templateIdOrName);
			}
			$uri .= '?tpl=' . $templateObj->getTemplateId();
		}
		return $uri;
	}