attajob 2011-12-10 00:55:41 3431次浏览 2条回复 0 0 0

刚开始接触Yii,想用Yii做公司人员的费用跟踪系统,以前在用过Concur,想模仿个那种功能的。 结构:

Expense Type( Expense Type ID, Expense Type Name, Expense Type Level 1, Expense Type Level 2, Expense Description)
Expense Record(Expense Record ID, Expense Owner, Expense Type, Currency, Amount,  Location, Description, Remark, Time Stamp )
Expense Report()

新建一个Expense Report,勾选Expense Record,生成Expense Report

大致思路是这样

  • 回复于 2011-12-10 01:10 举报

    wamp下装了个XAMPP
    建DB Study

    table expenselist
    table eprecord

    上述在phpMyaAdmin中完成

    用GII命令行做了
    model expenselist
    crud expenselist

    model eprecord
    crud eprecord

    在views/layouts/main.php中添加

    array('label'=>'Expense Record', 'url'=>array('/eprecord/index')),
    array('label'=>'Expense Type', 'url'=>array('/expenselist/index')),
    

    然后就可以看到连个网页,感觉很神奇,但是Label默认为table中的字段。
    想改成自己想要的Label,先是直接在views/eprecord/_form.php中直接改,但是提示为必填的红色*消失了,后来在
    models/eprecord.php 找到

    public function attributeLabels()
    {
        return array(
            'eprid' => 'Expense Record ID',
            'epruid' => 'Expense Owner ID',
            'ept' => 'Expense Type',
            'currency' => 'Currency',
            'amount' => 'Amount',
            'ets' => 'Time Stamp',
            'eloc' => 'Location',
            'eprr' => 'Remark',
        );
    }
    

    可以在这边修改为我想用的Label

  • 回复于 2011-12-10 01:17 举报

    接下来想改views/eprecord/_form.php
    想做的功能就是当相应的textbox得到光标时候,页面右侧就弹出相对应的选择项,这一步就比较犯迷糊,不知道到底怎么做

您需要登录后才可以回复。登录 | 立即注册