getType() public méthode

public getType ( ) : string
Résultat string
Exemple #1
0
 public function setProperty($p_dbColumnName, $p_value, $p_commit = true, $p_isSql = false)
 {
     if (!in_array($p_dbColumnName, $this->m_columnNames)) {
         return false;
     }
     $articleField = new ArticleTypeField($this->m_articleTypeName, substr($p_dbColumnName, 1));
     if ($articleField->getType() == ArticleTypeField::TYPE_BODY) {
         // Replace <span class="subhead"> ... </span> with <!** Title> ... <!** EndTitle>
         $text = preg_replace_callback("/(<\\s*span[^>]*class\\s*=\\s*[\"']campsite_subhead[\"'][^>]*>|<\\s*span|<\\s*\\/\\s*span\\s*>)/i", array('ArticleData', "TransformSubheads"), $p_value);
         // Replace <a href="campsite_internal_link?IdPublication=1&..." ...> ... </a>
         // with <!** Link Internal IdPublication=1&...> ... <!** EndLink>
         $text = preg_replace_callback("/(<\\s*a\\s*(((href\\s*=\\s*[\"'](\\/campsite\\/)?campsite_internal_link[?][\\w&=;]*[\"'])|(\\w+\\s*=\\s*['\"][_\\w]*['\"]))+[\\s]*)*[\\s\\w\"']*>)|(<\\s*\\/a\\s*>)/i", array('ArticleData', "TransformInternalLinks"), $text);
         // Replace <img id=".." src=".." alt=".." title=".." align="..">
         // with <!** Image [image_template_id] align=".." alt=".." sub="..">
         $idAttr = "(id\\s*=\\s*\"[^\"]*\")";
         $srcAttr = "(src\\s*=\\s*\"[^\"]*\")";
         $altAttr = "(alt\\s*=\\s*\"[^\"]*\")";
         $subAttr = "(title\\s*=\\s*\"[^\"]*\")";
         $alignAttr = "(align\\s*=\\s*\"[^\"]*\")";
         $widthAttr = "(width\\s*=\\s*\"[^\"]*\")";
         $heightAttr = "(height\\s*=\\s*\"[^\"]*\")";
         $otherAttr = "(\\w+\\s*=\\s*\"[^\"]*\")*";
         $pattern = "/<\\s*img\\s*(({$idAttr}|{$srcAttr}|{$altAttr}|{$subAttr}|{$alignAttr}|{$widthAttr}|{$heightAttr}|{$otherAttr})\\s*)*\\/>/i";
         $p_value = preg_replace_callback($pattern, array($this, "transformImageTags"), $text);
     }
     if ($articleField->getType() == ArticleTypeField::TYPE_SWITCH) {
         return parent::setProperty($p_dbColumnName, (int) ($p_value == 'on'), $p_commit);
     }
     return parent::setProperty($p_dbColumnName, $p_value, $p_commit, $p_isSql);
 }
Exemple #2
0
    ?>
		</select>
	</td>
</tr>
<TR>
	<TD COLSPAN="2">
	<DIV ALIGN="CENTER">
	<INPUT TYPE="HIDDEN" NAME="f_article_type" VALUE="<?php 
    print htmlspecialchars($articleTypeName);
    ?>
">
	<INPUT TYPE="submit" class="button" NAME="OK" VALUE="<?php 
    putGS('Save');
    ?>
">
	</DIV>
	</TD>
</TR>
</TABLE>
</FORM>
<P>
<?php 
    if ($articleField->getType() == ArticleTypeField::TYPE_TOPIC) {
        ?>
<script>
UpdateArticleFieldContext();
</script>
<?php 
    }
    camp_html_copyright_notice();
}
Exemple #3
0
if (!$g_user->hasPermission('ManageArticleTypes')) {
    camp_html_display_error($translator->trans("You do not have the right to reassign article type fields.", array(), 'article_type_fields'));
    exit;
}
$articleTypeName = Input::Get('f_article_type');
$fieldName = trim(Input::Get('f_field_name'));
$fieldType = trim(Input::Get('f_article_field_type'));
$field = new ArticleTypeField($articleTypeName, $fieldName);
$correct = true;
$errorMsgs = array();
if (!$field->exists()) {
    $errorMsgs[] = $translator->trans('The field $1 does not exist.', array('$1' => '<B>' . urlencode($fieldName) . '</B>'), 'article_type_fields');
    $correct = false;
}
if (array_search($fieldType, $field->getConvertibleToTypes()) === false) {
    $errorMsgs[] = $translator->trans('Can not convert the field $1 from $2 to type $3.', array('$1' => $fieldName, '$2' => $field->getType(), '$3' => $fieldType), 'article_type_fields');
    $correct = false;
}
if ($correct) {
    $field->setType($fieldType);
    $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
    $cacheService->clearNamespace('article_type');
    camp_html_goto_page("/{$ADMIN}/article_types/fields/?f_article_type=" . urlencode($articleTypeName));
}
$crumbs = array();
$crumbs[] = array($translator->trans('Configure'), "");
$crumbs[] = array($translator->trans('Article Types'), "/{$ADMIN}/article_types/");
$crumbs[] = array($articleTypeName, '');
$crumbs[] = array($translator->trans("Article type fields", array(), 'article_type_fields'), "/{$ADMIN}/article_types/fields/?f_article_type=" . urlencode($articleTypeName));
$crumbs[] = array($translator->trans("Adding new field", array(), 'article_type_fields'), "");
echo camp_html_breadcrumbs($crumbs);
Exemple #4
0
// Verify the merge rules
$ok = true;
$errMsgs = array();

foreach ($f_src_c as $destColumn => $srcColumn) {
	if ($srcColumn == 'NULL') {
		continue;
	}
	$destATF = new ArticleTypeField($f_dest, $destColumn);
	$srcATF = new ArticleTypeField($f_src, $srcColumn);

	if (!$destATF->isConvertibleFrom($srcATF)) {
        $errMsgs[] = getGS('Cannot merge a $1 field ($2) into a $3 field ($4).',
                            getGS($srcATF->getType()), $srcATF->getDisplayName(),
                            getGS($destATF->getType()), $destATF->getDisplayName());
        $ok = false;
	}
}

//
// if f_action is Merge, do the merge and return them to article_types/ screen (or an error)
//
if ($ok && $f_action == 'Merge') {
	if (!SecurityToken::isValid()) {
		camp_html_display_error(getGS('Invalid security token!'));
		exit;
	}

	$res = ArticleType::merge($f_src, $f_dest, $f_src_c);
    if (!$res) {
Exemple #5
0
    protected function getCustomProperty($p_property)
    {
        $property = $this->translateProperty($p_property);
        if (isset($this->m_customProperties[$property])
        && is_array($this->m_customProperties[$property])) {
            try {
                $dbProperty = $this->m_customProperties[$property][0];
                $fieldValue = $this->m_articleData->getProperty('F'.$dbProperty);

                $articleFieldType = new ArticleTypeField($this->type_name, $dbProperty);
                if ($articleFieldType->getType() == ArticleTypeField::TYPE_BODY) {
                    if (is_null($this->getContentCache($property))) {
                    	$context = CampTemplate::singleton()->context();
                    	$subtitleId = $this->subtitle_url_id($property);
                        $subtitleNo = $context->default_url->get_parameter($subtitleId);
                        if (is_null($subtitleNo)) {
                            $subtitleNo = 0;
                        } elseif ($subtitleNo === 'all') {
                            $subtitleNo = null;
                        }
                        $bodyField = new MetaArticleBodyField($fieldValue, $this,
                                         $articleFieldType->getPrintName(), $this->name, $subtitleNo,
                                         '<span class="subtitle"><p>', '</p></span>');
                        $this->setContentCache($property, $bodyField);
                    }
                    $fieldValue = $this->getContentCache($property);
                }
                if ($articleFieldType->getType() == ArticleTypeField::TYPE_TOPIC) {
                    $fieldValue = new MetaTopic($fieldValue);
                }
                return $fieldValue;
            } catch (InvalidPropertyException $e) {
                // do nothing; will throw another exception with original property field name
            }
            throw new InvalidPropertyException(get_class($this->m_dbObject), $p_property);
        }
        return parent::getCustomProperty($p_property);
    }
Exemple #6
0
if (!$g_user->hasPermission('ManageArticleTypes')) {
    camp_html_display_error(getGS("You do not have the right to reassign article type fields."));
    exit;
}
$articleTypeName = Input::Get('f_article_type');
$fieldName = trim(Input::Get('f_field_name'));
$fieldType = trim(Input::Get('f_article_field_type'));
$field = new ArticleTypeField($articleTypeName, $fieldName);
$correct = true;
$errorMsgs = array();
if (!$field->exists()) {
    $errorMsgs[] = getGS('The field $1 does not exist.', '<B>' . urlencode($fieldName) . '</B>');
    $correct = false;
}
if (array_search($fieldType, $field->getConvertibleToTypes()) === false) {
    $errorMsgs[] = getGS('Can not convert the field $1 from $2 to type $3.', $fieldName, $field->getType(), $fieldType);
    $correct = false;
}
if ($correct) {
    $field->setType($fieldType);
    camp_html_goto_page("/{$ADMIN}/article_types/fields/?f_article_type=" . urlencode($articleTypeName));
}
$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Article Types"), "/{$ADMIN}/article_types/");
$crumbs[] = array($articleTypeName, '');
$crumbs[] = array(getGS("Article type fields"), "/{$ADMIN}/article_types/fields/?f_article_type=" . urlencode($articleTypeName));
$crumbs[] = array(getGS("Adding new field"), "");
echo camp_html_breadcrumbs($crumbs);
?>
Exemple #7
0
    if (empty($tmp)) {
        $tmp = 'NULL';
    }
    $f_src_c[$destColumn->getPrintName()] = $tmp;
}
// Verify the merge rules
$ok = true;
$errMsgs = array();
foreach ($f_src_c as $destColumn => $srcColumn) {
    if ($srcColumn == 'NULL') {
        continue;
    }
    $destATF = new ArticleTypeField($f_dest, $destColumn);
    $srcATF = new ArticleTypeField($f_src, $srcColumn);
    if (!$destATF->isConvertibleFrom($srcATF)) {
        $errMsgs[] = getGS('Cannot merge a $1 field ($2) into a $3 field ($4).', getGS($srcATF->getType()), $srcATF->getDisplayName(), getGS($destATF->getType()), $destATF->getDisplayName());
        $ok = false;
    }
}
//
// if f_action is Merge, do the merge and return them to article_types/ screen (or an error)
//
if ($ok && $f_action == 'Merge') {
    if (!SecurityToken::isValid()) {
        camp_html_display_error(getGS('Invalid security token!'));
        exit;
    }
    $res = ArticleType::merge($f_src, $f_dest, $f_src_c);
    if (!$res) {
        $errMsgs[] = getGS("Merge failed.");
        $ok = false;
Exemple #8
0
$fieldName = trim(Input::Get('f_field_name'));
$fieldType = trim(Input::Get('f_article_field_type'));

$field = new ArticleTypeField($articleTypeName, $fieldName);

$correct = true;
$errorMsgs = array();

if (!$field->exists()) {
	$errorMsgs[] = getGS('The field $1 does not exist.', '<B>'.urlencode($fieldName).'</B>');
	$correct = false;
}

if (array_search($fieldType, $field->getConvertibleToTypes()) === false) {
	$errorMsgs[] = getGS('Can not convert the field $1 from $2 to type $3.',
	$fieldName, $field->getType(), $fieldType);
	$correct = false;
}

if ($correct) {
	$field->setType($fieldType);
	camp_html_goto_page("/$ADMIN/article_types/fields/?f_article_type=".urlencode($articleTypeName));
}

$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Article Types"), "/$ADMIN/article_types/");
$crumbs[] = array($articleTypeName, '');
$crumbs[] = array(getGS("Article type fields"), "/$ADMIN/article_types/fields/?f_article_type=".urlencode($articleTypeName));
$crumbs[] = array(getGS("Adding new field"), "");
 public function current_subtitle_no($p_fieldName)
 {
     $property = $this->translateProperty($p_fieldName);
     if (isset($this->m_customProperties[$property]) && is_array($this->m_customProperties[$property])) {
         $dbProperty = $this->m_customProperties[$property][0];
         $articleFieldType = new ArticleTypeField($this->type_name, $dbProperty);
         if ($articleFieldType->getType() == ArticleTypeField::TYPE_BODY) {
             $subtitleId = $this->subtitle_url_id($p_fieldName);
             return CampTemplate::singleton()->context()->default_url->get_parameter($subtitleId);
         }
     }
     return null;
 }
Exemple #10
0
    if (empty($tmp)) {
        $tmp = 'NULL';
    }
    $f_src_c[$destColumn->getPrintName()] = $tmp;
}
// Verify the merge rules
$ok = true;
$errMsgs = array();
foreach ($f_src_c as $destColumn => $srcColumn) {
    if ($srcColumn == 'NULL') {
        continue;
    }
    $destATF = new ArticleTypeField($f_dest, $destColumn);
    $srcATF = new ArticleTypeField($f_src, $srcColumn);
    if (!$destATF->isConvertibleFrom($srcATF)) {
        $errMsgs[] = $translator->trans('Cannot merge a $1 field ($2) into a $3 field ($4).', array('$1' => $translator->trans($srcATF->getType()), '$2' => $srcATF->getDisplayName(), '$3' => $translator->trans($destATF->getType()), '$4' => $destATF->getDisplayName()), 'article_types');
        $ok = false;
    }
}
//
// if f_action is Merge, do the merge and return them to article_types/ screen (or an error)
//
if ($ok && $f_action == 'Merge') {
    if (!SecurityToken::isValid()) {
        camp_html_display_error($translator->trans('Invalid security token!'));
        exit;
    }
    $res = ArticleType::merge($f_src, $f_dest, $f_src_c);
    if (!$res) {
        $errMsgs[] = $translator->trans("Merge failed.", array(), 'article_types');
        $ok = false;